How to set up multiple django versions on single apache service?
Question: I'm using Windows XP and want to know how can I create multiple django
versions on a single apache service through virtual host(of course).

I'm trying to do that with one instance of python too. Should i create 1
instance of python for each django version or django needs only its eggs to
work, so I can have several eggs in just one python version?


Answer: You can do something like this in your httpd.conf

    
    
    NameVirtualHost 0.0.0.0:80
    <VirtualHost 0.0.0.0:80>
        ServerName myserver.com
        ServerAdmin myemail@gmail.com
        DocumentRoot "/path/to/html/root"
        ErrorLog "/path/to/apache-error.log"
        CustomLog "/path/to/apache-access.log" common
    
        Options ExecCGI FollowSymLinks MultiViews
    
        AddHandler wsgi-script .wsgi
        WSGIDaemonProcess djangoapp1
        WSGIProcessGroup djangoapp1
        WSGIScriptAlias / /path/to/djangoapp1.wsgi
    
        Alias /static /path/to/static/files
    
        DirectoryIndex index.html index.cgi
    
        AddHandler cgi-script .cgi .pl
    </VirtualHost>
    
    NameVirtualHost 0.0.0.0:81
    <VirtualHost 0.0.0.0:81>
        ServerName myserver.com
        ServerAdmin myemail@gmail.com
        DocumentRoot "/path/to/html/root"
        ErrorLog "/path/to/apache-error.log"
        CustomLog "/path/to/apache-access.log" common
    
        Options ExecCGI FollowSymLinks MultiViews
    
        AddHandler wsgi-script .wsgi
        WSGIDaemonProcess djangoapp2
        WSGIProcessGroup djangoapp2
        WSGIScriptAlias / /path/to/djangoapp2.wsgi
    
        Alias /static /path/to/static/files
    
        DirectoryIndex index.html index.cgi
    
        AddHandler cgi-script .cgi .pl
    </VirtualHost>
    

And then, in your djangoapp1.wsgi/djangoapp2.wsgi script you can define the
different django versions and applications:

    
    
    #!/usr/bin/python
    import os
    import sys
    sys.path.append('')
    sys.path.append('/path/to/python2.7/site-packages')
    sys.path.append('/path/to/python2.7/dist-packages/Django-1.3-py2.7.egg ')
    ... etc ...
    sys.path.append('/path/to/djangoapp1/src')
    os.environ['DJANGO_SETTINGS_MODULE'] = 'djangoapp1.settings'
    os.environ['PYTHON_EGG_CACHE'] = '/tmp'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()
    

