1 min read

How to deploy wsgi with apache

Related to the  previors Post, i hade now to apply from virtualenv to a apache webserver. I used to deployed it with  the WSGI. For that you need to enable the mod_wsgi in apache2. To enable it in debian:
apt-get install libapache2-mod-wsgi
a2enmod wsgi
services apache2 restart
Now disabling the old mod_python in the configuration files. Add this to the top of your virtualhost file:
WSGIDaemonProcess $GROUPNAME python-path=/path/to/django/project/.env/lib/python2.6/site-packages user=apache group=apache processes=2 threads=25
WSGIScriptAlias / "/path/to/django/project/wsgi.py"
Documentroot /path/to/django/project/

 Order allow,deny
 Allow from all
This is it. Some details: Important is to set a  WSGIDaemonProcess, it allows to specifically the resource that the WSGI Process can use. Then the $GROUPENAME(Set it as you like to), so when you have more then one WSGI implementation, that the WSGI no interfering each other. There still some more options possible.