Recently, I had a need to create two separate Django projects. The requirements were similar but dissimilar enough that I wanted to have two projects rather than two apps in the same project. I decided to try and work with Apache to get the two sites running side-by-side on the same server.
Using two virtual environments, using the same process described here, my apache config looks like the following.
Project 1 is called Overview found at “/SRM” while Project 2 is codenames at “/codenames”.
<VirtualHost *:80> ServerName Overview ServerAlias overview.labs.lenovo.com/SRM Alias /static/ /var/www/html/Overview/static/ <Directory /var/www/html/Overview/static> Order deny,allow Allow from all </Directory> <Directory /var/www/html/codenames/static> Order deny,allow Allow from all </Directory> WSGIDaemonProcess codenames python-path=/home/Django/codenames:/home/virtualenvs/django_env/lib/python2.7/site-packages WSGIScriptAlias /codenames /home/Django/codenames/codenames/wsgi.py process-group=codenames WSGIDaemonProcess Overview python-path=/home/Django/Overview:/home/virtualenvs/django_env/lib/python2.7/site-packages WSGIScriptAlias /SRM /home/Django/Overview/Overview/wsgi.py process-group=Overview <Directory /home/Django/Overview/Overview> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> </VirtualHost>
So far so good.