WSGI Holygrail run multiple versions of Python on same webserver

September 7, 2010   

One issue hosting providers have is the issue with clients needing to run different version of python. One client might need python 2.4 and others might need 2.5. So in comes uWSGI

So this blog post will go over how to install uWSGI on RedHat 5 and making a uWSGI server for both python 2.4 and 2.5 at the same time for different hosts.

So the first thing you want to do is download the source

tar zxfv uwsgi-0.9.6.tar.gz
cd uwsgi-0.9.6

Now make the 2.4 version

make -f Makefile.Py24
mv uwsgi uwsgi24

Now make the 2.5 version

make -f Makefile.Py25
mv uwsgi uwsgi25

Now you have two binaries compiled to run 2.4 and 2.5 for python

So now you run the binaries

./uwsgi -s --pythonpath /tmp/multi/ -w django_wsgi

This will run a uWSGI server for a django app that is in /tmp/multi with a file.

You can then run

./uwsgi25 -s --pythonpath /tmp/multi/ -w django_wsgi

At the same time and they play nicely.

My file looks like

import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

comments powered by Disqus