You need to use the Django request object to get access to the WSGI
environ variable set and look them up there. When using SetEnv with
mod_wsgi, they are not pushed into os.environ. Although mod_python
does allow one to push variables into os.environ from Apache
configuration, that is arguably broken and can cause various problems.

So, from memory use:

  request.META['TIER']

Graham

On Dec 17, 5:58 am, Dashdrum <dgen...@gmail.com> wrote:
> I'm usingmod_wsgito 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.


Reply via email to