I have a virtualenv at /opt/webapps/ff/ with its own Python installation. I have WSGIPythonHome set to /opt/webapps/ff in my Apache config file (and this is definitely getting used in some capacity, because if I set it to a slightly different existing directory and restart Apache I get a 504). But if I e.g. assert False
in a view somewhere to bring up the Django debug page, I see that settings.PYTHON_BIN is /usr/bin
rather than /opt/webapps/ff/bin
.
How do I get Apache/mod_wsgi to use my virtual environment's Python binary? I thought setting WSGIPythonHome was the way to do this, but it only seems to affect which site-packages dir is used, not which binary is used. Thanks.
I had the same situation in a Pylons app and ended up using
/usr/bin
binary plus virtualenv site-packages dir instead.Of course it was the same python version...
I have encountered the same issue when installing modoboa (django based) in virtualenv.
It took me a lot of time to find a clear answer, so I will post it here.
All I needed to do was adding two lines to the general apache conf file (/etc/httpd/conf/httpd.conf in CentOS):
And restart Apache
If you're using a virtualenv, you need to be sure to activate it within the WSGI script.
These are the instructions I used which seem to be working well.
http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
Here is a discussion about this issue as well
http://groups.google.com/group/modwsgi/browse_thread/thread/466823f087070b5f?pli=1