Dave
Dave

Reputation: 2949

Apache Multiple Django Sites Including Root

I would like to serve multiple django apps using mod_wsgi including one at root. Currently my apache config looks like this:

WSGIScriptAlias /app1 /path/to/app1/wsgi.py
<Directory /path/to/app1>
    Order deny,allow 
    Allow from all
</Directory>

WSGIScriptAlias /app2 /path/to/app2/wsgi.py
<Directory /path/to/app2>
    Order deny,allow
    Allow from all
</Directory>

WSGIScriptAlias / /path/to/main-app/wsgi.py
<Directory /path/to/main-app>
<Files wsgi.py>
    Order deny,allow
    Allow from all
</Files>
</Directory>

If i switch that last directive to /main it works fine, but if i try to serve that last directive as written then apache searches for /app1/folder one in /folder1 and i get 500 errors for each of the first two directive. Is there a way too do this, outside of configuring app1.servername and app2.servername?

Upvotes: 0

Views: 174

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58563

Do you really mean for /app2 to map to /path/to/app1/wsgi.py?

Other than that, there is nothing wrong with that Apache configuration snippet.

Make sure you are not wrongly setting FORCE_SCRIPT_NAME in your Django settings file.

Make sure you aren't use setdefault() in wsgi.py for Django to set DJANGO_SETTINGS_MODULE. See:

Upvotes: 1

Related Questions