Dan,

This works for me -- using mod_python.

VirtualHost defininition:
> SetEnv VIRTUAL_HOST_NAME dev.hostname.com
>     SetEnv DATABASE_NAME dbname
settings.py:
> VIRTUAL_HOST_NAME = os.environ.get('VIRTUAL_HOST_NAME')
> DATABASE_NAME = os.environ.get('DATABASE_NAME')
Liam

Dashdrum wrote:
> I'm using mod_wsgi to host my Django site, and all is working well,
> except...
>
> I'd like to access an environment variable set in the Apache
> configuration like so:
>
>     SetEnv TIER dev
>
> The os.environ.get() function seems appropriate for this, but no
> luck.  Using this code:
>
>
>     PATH = os.environ.get('PATH','')
>     DJANGO_SETTINGS_MODULE = os.environ.get
> ('DJANGO_SETTINGS_MODULE','')
>     SERVER_NAME = os.environ.get('SERVER_NAME','')
>     TIER = os.environ.get('TIER','')
>
> PATH comes from the operating system (Red Hat) and the proper value is
> returned.  Likewise, DJANGO_SETTINGS_MODULE returns the correct string
> after it is set in django.wsgi.
>
> However, both SERVER_NAME and the custom variable TIER are not
> returned.
>
> Any advice would be most appreciated.
>
> Dan Gentry
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>   

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to