Tuesday, January 18, 2011

mod_wsgi+Django with a different Python version

My server runs Python 2.4 by default, and I've used make altinstall to get an alternate Python 2.6 installation, for my Django webapp.

However, mod_wsgi seems to be defaulting to using /usr/bin/python (2.4) rather than /usr/local/bin/python2.6.

Is there a simple way to force mod_wsgi to use Python 2.6?

  • Read the documentation for mod_wsgi and it tells you what to do. See:

    http://code.google.com/p/modwsgi/wiki/InstallationIssues#Multiple_Python_Versions

    Specifically, use the WSGIPythonHome directive to tell mod_wsgi that your Python is actually in a different location.

    If this doesn't work, then make sure you are no longer loading mod_python into same Apache if you had been previously. Perform a complete stop and start of Apache, not just a reload, for good measure to ensure that mod_python no longer hanging around. The mod_python module cant be used at the same time because it will take precedence in initialising Python and will use what ever it is compiled against, which could well be different to mod_wsgi. Normally this mixing will cause a crash, but feasible it may carry along a little bit before deciding to croak it.

    BobMarley : Sorry, I don't know how I missed that bit of documentation! The documentation on the -fPIC error proved helpful, too. Thank you so much!

0 comments:

Post a Comment