What I have:
Apache http server with 4 virtual servers with distinc domains:
www.mydomain.com points to /var/www/mydomain/htdocs (php code)
and it works. All other domains are irrelevant.
On another machine, I developed a django project with two applications, and it works well with the django buj-in server.
What I need:
www.mydomain.com pointing to /var/www/mydomain/htdocs (php code) www.mydomain.com/recsys pointing to /opt/repsys (django code)
I want to save the PHP root code and install django inside / repsys.
I can put my django code in the root directory, but when I try to paste inside / repsys, I have two problems:
- I had to put / repsys in all the urls of my settings.py file (this is not a problem, but it is strange for me).
And I have this error from django code:
Reverse for 'ajax' with arguments' (u'viewproject ',)' and keyword arguments' {} 'not found
I see that this is due to changing the url (now it includes / repsys), and django does not know how to cancel this url, but I have no idea how to fix it ...
My django: 1.5.1
Here is my wsgi.py
import os, sys sys.path.append('/opt/repsys') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "repsys.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
and my apache conf file for this virtual server:
LoadModule wsgi_module modules/mod_wsgi.so WSGISocketPrefix /var/run/wsgi #WSGIPythonPath /opt/repsys/ <VirtualHost *:80> WSGIDaemonProcess repsyssite display-name=%{GROUP} WSGIProcessGroup repsyssite ServerAdmin blahhh@gmail.com ServerName www.mydomain.com DocumentRoot "/var/www/mydomain/htdocs" WSGIScriptAlias /reprep /opt/repsys/repsys/wsgi.py Alias /reprep/static /opt/repsys/static_serve Alias /reprep/media /opt/repsys/media Alias /admin_media /home/myuser/Django-1.5/django/contrib/admin/media <Directory opt/repsys> Order allow,deny Allow from all </Directory> # Logfiles ErrorLog /var/www/logs/glob/error.log CustomLog /var/www/logs/glob/access.log combined </VirtualHost>
My main url.py includes:
url(r'^report/', include('report.urls', namespace="report")),
And my /url.py report includes:
url(r'^(?P<fn>\w+)/ajax/$', views.ajax, name='ajax'),
And here is the line that works when I put my project in the root directory, but does not work when it is inside the folder:
$('#viewreportdiv').load("{% url 'report:ajax' 'viewproject' %}", {proj: id});
Can someone point out how to fix this?