I have a server on which I have two sites built with Django and Python, one site is major site is build with an older version of django, the other with the newer release, I have upgraded to the new release and major aspects of my other site have broken, is it possible to tell the site to use a different version in say the python path? in the virtualhost?

I am desperate for help!

Some more info, it is on a linux and server users mod python, here is what I am trying with the vitrualhost

<Location "/">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE website.settings
        SetEnv PYTHON_EGG_CACHE /var/cache/pyeggcache
        SetEnv PYTHONPATH "sys.path + ['usr/lib/python2.6/site-packages/django2']"
        PythonDebug On
        PythonPath "['/var/www/website_live/src'] + ['/var/www/webiste_live/src/website'] + sys.path"
    </Location>

I have replaced the website name with 'website' my seperate version of django lives at /usr/lib/python2.6/site-packages/django2

Comments

You definitely can use two different releases simultaneously. But to answer the question we need to know what software you're using: apache, nginx, mod_python or mod_wsgi.

Written by Eugene Morozov

Accepted Answer

When you have more than one site on a server, you should consider using something like virtualenv.

Using that you can setup different virtual environments and place site specific packages and such in there, instead of messing up your site-packages folder. It also makes development a lot easier as you easily can setup these environments on your local with specific versions of whatever you use.

This quickly becomes very handy if you use other apps, and this is something that Pinax uses very heavily. The easiest way to handle packages and versions is simply to create a requirements file.

Written by googletorp
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki