Django wsgi multiple projects different url same apache server

apache-2.2djangomod-wsgiurl

I'm trying to get 2 separate django projects running on the same apache server with mod_wsgi that are also under the same domain but different urls. Like www.example.com/site1/ and www.example.com/site2

What I'm trying to do is something like…

<VirtualHost *:80>
    ServerName www.example.com

    <location "/site1/">
        DocumentRoot "/var/www/html/site1"
        WSGIScriptAlias / /var/www/html/site1/django.wsgi
    </location>

    <location "/site2/">
        DocumentRoot "/var/www/html/site2"
        WSGIScriptAlias / /var/www/html/site2/django.wsgi
    </location>

</VirtualHost>

The closes thing I've seen is this http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ but "mysite" is different for both of these cases and they're using mod_python instead of mod_wsgi.

Any help with this would be great thanks!

Best Answer

Use:

WSGIScriptAlias /site1 /var/www/html/site1/django.wsgi
WSGIScriptAlias /site2 /var/www/html/site2/django.wsgi

<Directory /var/www/html/site1>
Order allow,deny
Allow from all
</Directory>

<Directory /var/www/html/site2>
Order allow,deny
Allow from all
</Directory>

No need to scope it in a Location directive.