Django apache + mod_wsgi with virtualenv

Posted by ArgsKwargs on Server Fault See other posts from Server Fault or by ArgsKwargs
Published on 2012-07-02T14:43:23Z Indexed on 2012/07/02 15:17 UTC
Read the original article Hit count: 242

Filed under:
|
|
|
|

I have some questions running multiple Django sites on a VPS

I have a server that uses openPanel to automatically create VirtualHosts within apache2.

My ideal situation is that I would have multiple virtualenvs with different dependencies installed so the python dist-packages directory isn't contaminated for different Django sites.

For example:

/home/user/virtualenv1
/home/user/virtualenv2

My django applications reside at /var/www, so

For example:

/var/www/djangosite1
/var/www/djangosite2

Now I've read upon openPanel docs and figured out the best thing todo is create a django.conf file inside the mydomain.com.inc folder, which looks something like:

/etc/apache2/openpanel.d/mydomain.com.inc/django.conf

DocumentRoot /var/www/djangosite1/project

WSGIScriptAlias / /var/www/djangosite1/project/wsgi.py
WSGIDaemonProcess mydomain python-path=/home/user/virtualenv1/lib/python2.6/site-packages

<Directory /var/www/djangosite1/project>
   Order allow,deny
   Allow from all
</Directory>

Alias /static /var/www/djangosite1/project/static-root

Now my problem is that this setup seems unable to find the virtualenv site-packages thus not recognizing any dependencies available in the given virtualenv

Also, commenting out this line doesn't seem to break or change a thing:

WSGIDaemonProcess mydomain python-path=/home/user/virtualenv1/lib/python2.6/site-packages

For example:

> service apache2 start
ImportError: No module named South

When I install South outside the virtualenv everything works

© Server Fault or respective owner

Related posts about apache2

Related posts about debian