Multiple Django Applications Using virtualenv on Apache 2 on Ubuntu 11

I have successfully installed one Django application using virtualenvon Ubuntu and Apache 2 using a directive WSGIPythonHomepointing to my location virtualenv. Now I need to create a separate Django application that will run on Apache on a different port on the same Ubuntu server. I am wondering if there is a way for Apache to run multiple instances WSGIPythonHome? Currently, with WSGIPythonHomeone root being installed virtualenv, there is a problem with importing in the second Django application ...

+5
source share
2 answers

The best way to do this, I discovered about a year ago, is to use WSGI as a daemon and set the python path in the daemon directive. Example below

<VirtualHost *:80>
    ServerName yourhost.com

    <Directory />
      Order deny,allow
      #Require all granted
    </Directory>

    #Alias /static /opt/yourhost/static
    WSGIScriptAlias / /opt/yourhost/wsgi.py

    WSGIApplicationGroup %{GLOBAL}

    WSGIDaemonProcess yourhost.com python-path=/opt/yourhost:/opt/yourhost/venv/lib/python2.7/site-packages processes=2 threads=15 display-name=%{GROUP}
    WSGIProcessGroup  yourhost.com
</VirtualHost>
WSGISocketPrefix /var/run/wsgi
+2
source

You must do this using separate virtual hosts in Apache. Each of them can listen on a specific port and can have its own WSGI directives.

0
source

All Articles