If the auto generated wsgi.py is using setdefault they have broken it very badly. When running in a multiple sub interpreter process, the first wsgi.py in any sub interpreter will win for the whole process. This is because setting os.environ, pushes values back out to process scope and when next sub interpreter is created it will pick up the value of the environment variable leaked from the other sub interpreter.
I will have to look at original Django and if this is what they are doing, then yell a people about it. To fix, don't use setdefault. Just use '=' to set value in os.environ. Graham On 04/07/2012, at 5:57 AM, Benjamin Bach <[email protected]> wrote: > > On Wednesday, June 27, 2012 2:09:27 AM UTC+2, Graham Dumpleton wrote: > But are you using daemon mode? > > Provide a sample of your mod_wsgi configuration for a site. > > Thanks for responding, this is my Apache configuration: > > <VirtualHost *:80> > DocumentRoot /var/www > ServerName example.com > WSGIScriptAlias / /var/sites/example_com_site/wsgi.py > </VirtualHost> > > The wsgi.py file is the default provided in the new Django 1.4 layout. It > contains this line: > > os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_com_site.settings") > > Could it be that this environment variable is already set? > > From the documentation of setdefault: > > If key is in the dictionary, return its value. If not, insert key with a > value of default and return default. default defaults to None. > > ...and maybe this is more correct? > os.environ['DJANGO_SETTINGS_MODULE'] = 'example_com_site.settings' > > - Benjamin > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/modwsgi/-/uqBtTkv1h6YJ. > 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. -- 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.
