I've got a server on which i've two sites constructed with Django and Python, one website is major website is build by having an older version of django, another using the more recent release, I've upgraded towards the era and major facets of my other site have damaged, can you really tell the website to utilize a different version in the python path? within the virtualhost?

I'm eager for help!

More info, it's on the linux and server customers mod python, here's what I'm trying using the vitrualhost

<Location "/">

        SetHandler python-program

        PythonHandler django.core.handlers.modpython

        SetEnv DJANGO_Configurations_MODULE website.configurations

        SetEnv PYTHON_EGG_CACHE /var/cache/pyeggcache

        SetEnv PYTHONPATH "sys.path + ['usr/lib/python2.6/site-packages/django2']"

        PythonDebug On

        PythonPath "['/var/world wide web/website_live/src'] + ['/var/world wide web/webiste_live/src/website'] + sys.path"

    </Location>

I've changed the web site title with 'website' my seperate version of django lives at /usr/lib/python2.6/site-packages/django2

Yes, you can. I've blogged relating to this in more detail over here.

If you have several site on the server, you should look at using something similar to virtualenv.

Using that you could setup different virtual conditions and put site specific packages and the like inside, rather than playing your site-packages folder. Additionally, it makes development a great deal simpler while you easily can setup these conditions in your local with specific versions of anything you use.

This rapidly becomes very handy if you are using other applications, which is one thing that Pinax uses very heavily. The simplest method to handle packages and versions is merely to produce a needs file.

Obviously it's, but it may need a little of nestling. It is dependent mainly which server you utilize.

The main factor may be the $PYTHONPATH. This variable stores, where Python searches for modules to embed. If you are using

import django.conf

it looks through all dirs in $PYTHONPATH and looks for a folder known as django.

So the bottom line is to control $PYTHONPATH based on in which the request would go to. If you use mod_python and Apache, it might seem like this:

<VirtualHost *:80>

    DocumentRoot "/var/htdocs/old_django_project"

    ServerName old-django

    PythonPath "sys.path + ['/var/software/old_django']"

</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "/var/htdocs/new_django_project"

    ServerName new-django

    PythonPath "sys.path + ['/var/software/new_django']"

</VirtualHost>

Then, going to http://old-django/ brings you to definitely that old django instance, and also the new-django likewise.

It's possible, but in my opinion of the atmosphere that used different versions of both Django and Python it has a tendency to finish up getting untidy, particularly if you have several developer focusing on the projects. Each developer then must maintain two versions of Django and don't forget which features they are able to and can't use.

I personally use Wigwam with this kind of factor. It is a heavy-handed approach &mdash there is a separate build of every of Apahce, Python, Django, etc. &mdash however it works very well.