These are the steps remaining from our previous article. In order to complete our desired setup we must configure Apache with mod_wsgi
pointing to the new virtual environment.
But before we can even do that, we need to setup mod_wsgi
, which in our case will require building it and installing it from source.
Setting up mod_wsgi
with our virtual Environment
Detailed explanations for using virtual environments in mod_wsgi
can be found here.
Just by reading over a bit, and based on some prior experience (2+ years ago, though), I was expecting this to be the main pain area of the whole process. From the docs I read that mod_wsgi
has to be compiled against the same version of Python your code will be running under. Which means I will have to build from source, since Ubuntu 9.04’s version of mod_wsgi is linked with its included version of Python 2.6.
Build mod_wsgi
First, we must build and install mod_wsgi
to use the correct version of Python. The installation guide for mod_wsgi
is very clear, you just need to follow it. Below are the distilled steps my installation needed.
We start by installing the Apache2 development libraries (which we will need in order to install mod_wsgi
), and downloading mod_wsgi
from its subversion repository.
sudo apt-get install apache2-dev svn co http://modwsgi.googlecode.com/svn/branches/mod_wsgi-2.X mod_wsgi-2.x cd !$