I would like to run a Django project on a server using virtualenv in Apache using mod_python. Now I know that the recommended apache module to use is mod_wsgi, but I don’t want to install that for now.
The default python installation on the server is python2.4, which is used by some other website on the server. Because my project was built on python2.6 I installed it next to python2.4 in /usr/local/ using ‘make altinstall’.
I’ve used this website to setup my apache conf file: http://mydjangoblog.com/2009/03/30/django-mod_python-and-virtualenv/.
My question is: is there a way to specify that it (mod_python probably) should use python2.6 instead of python2.4?
If there is no way to run 2 python versions in one apache using mod_python, would it be possible using mod_wsgi? Or would it be possible in one apache installation with the other site using mod_python and me using mod_wsgi?
No, you cannot do this. mod_python is pre-compiled with a particular Python version. If you wanted to change that version, you’d have to re-compile mod_python – and if you’re doing that, you might as well install mod_wsgi.
It is possible with mod_wsgi, as that doesn’t embed an interpreter into Apache itself, so it doesn’t care what version you use. It’s quite easy to get virtualenv working with mod_wsgi – you just need to activate the virtualenv inside your
.wsgiscript: