Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Running multiple Django projects on one Apache instance with mod_wsgi
STATIC_URL = '/site1/static/'
# adjust name of session id
SESSION_COOKIE_NAME = "site1"
STATIC_URL = '/site2/static/'
# adjust name of session id
SESSION_COOKIE_NAME = "site2"
# /etc/apache2/sites-available/site1-site2.conf
WSGIDaemonProcess site1 python-home=/var/www/site1 python-path=/var/www/site1
WSGIProcessGroup site1
WSGIDaemonProcess site2 python-home=/var/www/site2 python-path=/var/www/site2
WSGIProcessGroup site2
# works with SSL too
<VirtualHost *:80>
Alias /site1/static/ /var/www/site1/myapp/static/
<Directory /site1/static>
Require all granted
</Directory>
WSGIScriptAlias /site1 /var/www/site1/myproj/wsgi.py process-group=site1
<Directory /var/www/site1/myproj>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /site2/static/ /var/www/site2/myapp/static/
<Directory /site2/static>
Require all granted
</Directory>
WSGIScriptAlias /site2 /var/www/site2/myproj/wsgi.py process-group=site2
<Directory /var/www/site2/myproj>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.