It's a little involved (well, a lot involved), but Silver Lining does this:
http://bitbucket.org/ianb/silverlining/src/tip/silverlining/server-root/etc/apache2/sites-enabled/wsgi_runner

Basically you need a WSGIApplicationGroup for each environment, and in my
case I use one wsgi file (
http://bitbucket.org/ianb/silverlining/src/tip/silverlining/mgr-scripts/master-runner.py)
that uses environ['HTTP_HOST'] to find and activate the environment.

On Tue, Jun 15, 2010 at 3:50 PM, Aljosa Mohorovic <
[email protected]> wrote:

> i'm trying to create mod_wsgi configuration that support public site/
> wsgi application and development releases.
> idea is that for every release i create a clean python environment
> (using virtualenv) under /var/www/wsgi/www.example.com/releases/
> ---
> $ ls /var/www/wsgi/www.example.com/releases/
> r1 r2 r3 r4 r5
> ---
> and using pip install new release (and dependencies) into new
> virtualenv/python environment.
>
> if apache vhost configuration contains:
> ---
> ServerName www.example.com
> ServerAlias r*.www.example.com
>
> WSGIScriptAlias / /var/www/wsgi/www.example.com/project.wsgi
> ---
> i can easily add:
> >> site.addsitedir("/var/www/wsgi/
> www.example.com/current/env/lib/python2.6/site-packages/")
> where /var/www/wsgi/www.example.com/current/ is symlink to latest
> release (example: /var/www/wsgi/www.example.com/releases/r5/).
>
> so www.example.com will display latest release but i also would like
> to access other releases via r(\d).www.example.com.
> i can get SERVER_NAME in project.wsgi from environ but i think
> sys.path will get mixed if i try to resolve this in project.wsgi or am
> i wrong?
>
> i'm open to any suggestion, i would only like to preserve separate
> virtualenv/python environments for each release.
> other than that i have no problems in having project.wsgi for each
> release and in apache vhost configuration point to different wsgi
> files for each subdomain.
>
> any ideas, tips, comments are appreciated.
>
> Aljosa Mohorovic
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<modwsgi%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
>
>


-- 
Ian Bicking  |  http://blog.ianbicking.org

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to