Re: Apache environment variables in Django 1.6

2013-11-22 Thread Jon Dufresne
> With you setup is it possible to run into some race conditions when two > simultaneous request coming for the first time when _application is still > uninitialized? That is a good question, to which I do not have a good answer. If you come across any issues with this solution I'd be interested

Re: Apache environment variables in Django 1.6

2013-11-22 Thread Mike Starov
Very nice. I have moved import inside the application call but was concerned about evaluating that impot on every request. Looks like you got that covered. With you setup is it possible to run into some race conditions when two simultaneous request coming for the first time when _application is

Re: Apache environment variables in Django 1.6

2013-11-21 Thread Jon Dufresne
On Thu, Nov 21, 2013 at 8:46 AM, Mike Starov wrote: > I encountered same issue in my deployment. Have you found a solution? > Yes I did. I am still not sure if this is a bug or intentional. It appears that in 1.6, settings.py is now imported *before* the first run of the WSGI application. Therefo

Re: Apache environment variables in Django 1.6

2013-11-21 Thread Mike Starov
.environ['MY_SETTING']. > > Is this a bug that this no longer works in Django 1.6? Is there a > better way to access Apache environment variables? > > Thanks > -- You received this message because you are subscribed to the Google Groups "Django

Apache environment variables in Django 1.6

2013-11-20 Thread Jon Dufresne
s.py, I would access MY_SETTING using os.environ['MY_SETTING']. Is this a bug that this no longer works in Django 1.6? Is there a better way to access Apache environment variables? Thanks -- You received this message because you are subscribed to the Google Groups "Django users&quo

Re: Apache Environment Variables

2009-12-17 Thread Graham Dumpleton
On Dec 18, 3:57 pm, Info Cascade wrote: > 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

Re: Apache Environment Variables

2009-12-17 Thread Info Cascade
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

Re: Apache Environment Variables

2009-12-17 Thread Dashdrum
Thanks to both responders for the explanations. Dan -- 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...@goog

Re: Apache Environment Variables

2009-12-16 Thread fivegrainja
I wrestled with this same issue a few days ago. The section "Application Configuration" on this page provides some guidance: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines In a nutshell, the apache SetEnv isn't setting values in the process environment that os.environ represents.

Re: Apache Environment Variables

2009-12-16 Thread Graham Dumpleton
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 bro

Apache Environment Variables

2009-12-16 Thread Dashdrum
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.g