Multiple Django sites with a single host and IP on Apache

After hours of trying, Graham made my day

Graham Dumpleton: Requests running in wrong Django instance under Ap...: Configuring Apache/mod_wsgi to host multiple Django instances has always been a bit tricky for some. In practice though it should be quite ...


My working sample:

<VirtualHost *:80>
        WSGIPassAuthorization On

        WSGIDaemonProcess app1 python-path=/home/ubuntu/app1_django:/home/ubuntu/.venv/app2_venv/lib/python2.7/site-packages
        WSGIScriptAlias /app1 /home/ubuntu/app1_django/app1/wsgi.py process-group=app1
        WSGIDaemonProcess app2 python-path=/home/ubuntu/app2_django:/home/ubuntu/.venv/app2_venv/lib/python2.7/site-packages
        WSGIScriptAlias /app2 /home/ubuntu/app2_django/app2_django/wsgi.py process-group=app2
        <Directory /home/ubuntu/app1_django/app1>
                <Files wsgi.py>
                Require all granted
                </Files>
        </Directory>
        <Directory /home/ubuntu/app2_django/app2_django>
                <Files wsgi.py>
                Require all granted
                </Files>
        </Directory>
        DocumentRoot /home/ubuntu

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

Comments

Popular Posts