[Django]-Can I have 2 Django sites using 2 different version of Python on 1 domain?

0👍

While you can host multiple domains / sites under a single version of Python with mod_wsgi, as far as I know you can not have multiple versions of Python running since mod_wsgi has to be compiled against a single version.

For Centos 6, first follow the instructions here to buy Python 2.7.x or 3.x to an alternative location (make altinstall):

https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4

Then, you should be able to fire up Python and check your version:

python2.7 --version

Next, create a virtualenv (I use virtualenvwrapper; highly recommended):

mkvirtualenv yourproject -p python2.7

Then, install mod_wsgi for the new Python version (4.2.8 is the latest I’ve tested in my vagrant box; you may want to try a more recent version):

wget -q "https://github.com/GrahamDumpleton/mod_wsgi/archive/4.2.8.tar.gz"
tar -xzf '4.2.8.tar.gz'
cd ./mod_wsgi-4.2.8
./configure --with-python=python2.7
make
make install

Finally, if everything worked, ensure you point to the correct virtualenv in this line:

WSGIScriptAlias /gclicks /var/www/venv/gc/gc/wsgi.py process-group=gclicks

-1👍

Try this, I am not sure about different python version but you can have multiple sites under one domain.

Leave a comment