Hi,
I am deploying a web2py application, and I will be serving it with Apache
via mod_wsgi. I have the following WSGI directives in my virtual host
configuration:
WSGIDaemonProcess web2py user=www-data group=www-data \
display-name=%{GROUP}
WSGIProcessGroup web2py
WSGIScriptAlias / /var/www/web2py/wsgihandler.py
This is working, but it is taking the system wide python installation. As a
result, some packages are not found (since they are only present in my
virtualenv). I would like to tell this particular virtual host (or the
whole Apache, if there is no other way), to use the python installation in
my virtual environment (/home/myuser/.virtualenvs/python2.7.2/bin).
Is it possible to configure this for Apache? Or better, just for my virtual
host? I would like to cause as little effect as possible to the rest of the
system (specifically, I do not want to modify the default python version
used system wide)
I have tried different things, like:
Adding the following to wsgihandler.py:
activate_this = '/path/to/virtualenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this)
import sys
sys.path.insert(0, '/path/to/web2py_dir')
Also, modififying the /etc/init.d/apache2 script, adding the following:
ENV="env -i LANG=C
PATH=/home/myuser/.virtualenvs/python2.7.2/bin:/usr/local/bin:/usr/bin:/bin"
export PATH="/home/myuser/.virtualenvs/python2.7.2/bin:$PATH"
python -V
Strangely enough, the python -V shows that the right python binary is
active (the one in the virtualenv, 2.7.2), but web2py, in the error
reports, is showing the following:
web2py™ (2, 0, 0, datetime.datetime(2012, 7, 1, 22, 43, 58), 'dev')
Python Python 2.6.5: /home/myuser/.virtualenvs/python2.7.2/bin/python
So is it using 2.6.5 or 2.7.2? The python installed
in /home/myuser/.virtualenvs/python2.7.2/bin/python *is* 2.7.2.
What I need is to use the virtualenv *and* python 2.7.2, which is not the
system-wide python, but the one in the virtualenv.
Do you have any suggestions?
Thanks,
Daniel
--