2010-03-09 4 views
0

Je souhaite configurer des versions de test et de production d'une application Django sur des hôtes virtuels de nom apache distincts et je voulais savoir comment le faire.Comment exécuter plusieurs versions d'une application Django avec mod_python?

Voici ce que j'ai fait, et ça semble fonctionner, mais je me demande s'il y a une meilleure solution.

<VirtualHost *> 
    ServerName test.foo.bar 

    <Location "/app/"> 
     SetHandler python-program 
     PythonPath "['/home/jdm/django-apps/xyz/test/'] + sys.path" 
     PythonHandler django.core.handlers.modpython 
     SetEnv DJANGO_SETTINGS_MODULE settings 
    PythonOption django.root /app 
     PythonDebug On 
     PythonInterpreter test 
    </Location> 

</VirtualHost> 


<VirtualHost *> 
    ServerName live.foo.bar 

    <Location "/app/"> 
     SetHandler python-program 
     PythonHandler django.core.handlers.modpython 
     PythonPath "['/home/jdm/django-apps/xyz/live/'] + sys.path" 
     SetEnv DJANGO_SETTINGS_MODULE settings 
     PythonOption django.root /app 
     PythonDebug On 
     PythonInterpreter live 
    </Location> 

</VirtualHost> 

Les applications vivent dans/home/JDM/django-apps/xyz/live/et/home/JDM/django-apps/xyz// test. Les applications sont à http://live.foo.bar/app/ et http://test.foo.bar/app/

Répondre

0

Je pense que virtualenv est ce dont vous avez besoin.

Questions connexes