Strange - only one thing was equal for switched requests - PID.
Interpreter, host type, os.environ, hostname etc proper for
VirtualHost. Anyway, I switched to FastCgi (stil considering mod_wsgi
and scgi) and problem disappeared.

Cheers,

On 4 Lip, 03:30, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
> Correct. The whole problem is effectively the result of a race
> condition on setting os.environ the first time just before Django
> settings file is imported. Normally the requests should be getting
> handled in the same Python subinterpreter though and thus os.environ
> would be different for each subinterpreter, but that ServerAlias
> overlaps with the name of the other VirtualHost must be causing Apache
> to handle the request under the context of the wrong VirtualHost.
>
> One way of confirming which Python subinterpreter is being used, is to
> do:
>
>   from mod_python import apache
>
> and send back the value of:
>
>   apache.interpreter
>
> in a web page so you can see what it is.
>
> You might also display the value of:
>
>   apache.main_server.server_hostname
>   apache.main_server.names
>   apache.main_server.wild_names
>
> These show the value of ServerName and ServerAlias.
>
> Graham
>
> On Jul 4, 12:53 am, bluszcz <[EMAIL PROTECTED]> wrote:
>
> > I've just found one thing - this happen if two users send two request
> > at once - one for admin.coke, second for *.coke. This happen when
> > apache handling these requests by one process (i set PID logging..)
>
> > On 3 Lip, 13:41, bluszcz <[EMAIL PROTECTED]> wrote:
>
> > > Thanks Graham for the fast reply. Unfortunately, I cannot list the
> > > sites directly - too much of them (about 100), and generally I have to
> > > handle all except of 'admin' one :(
>
> > > On 3 Lip, 13:07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
> > > > On Jul 3, 8:40 pm, bluszcz <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello people - I wrote earlier this mail on django devs but Adrian and
> > > > > Graham pointed me, that I should write here.
>
> > > > > I am using Apache 2.0 and mod python 3.3,1 on Ubuntu Dapper x86_64. I
> > > > > found a strange behavior during SetEnv directive. But let's start from
> > > > > the
> > > > > beginning. I have two virtual hosts, one admin and one application,
> > > > > both of them works on the same settings file:
>
> > > > > <VirtualHost *:80>
> > > > >        ServerName admin.bluszcz.coke
> > > > >        PythonDebug On
> > > > >        SetHandler python-program
> > > > >        PythonHandler django.core.handlers.modpython
> > > > >        PythonPath "sys.path + ['/home/bluszcz/coke/app']"
> > > > >        SetEnv DJANGO_SETTINGS_MODULE pepsi.settings
> > > > >        SetEnv HOME /home/bluszcz
> > > > >        PythonInterpreter Admin
> > > > >        SetEnv ADMINOS True
>
> > > > > </VirtualHost>
>
> > > > > <VirtualHost *:80>
> > > > >        ServerName bluszcz.coke
> > > > >        ServerAlias *.bluszcz.coke
>
> > > > Try listing your site aliases explicitly rather than using a wildcard.
> > > > Maybe the problem is that because the wildcard can match the name of
> > > > your other virtual host, ie., admin.bluszcz.coke, that which one
> > > > Apache sends the request to may be a bit random.
>
> > > > >        PythonDebug On
> > > > >        SetHandler python-program
> > > > >        PythonHandler django.core.handlers.modpython
> > > > >        PythonPath "sys.path + ['/home/bluszcz/coke/app']"
> > > > >        SetEnv DJANGO_SETTINGS_MODULE pepsi.settings
>
> > > > Do you mean coke.settings here.
>
> > > > >        SetEnv HOME /home/bluszcz
> > > > >        PythonInterpreter Coke
> > > > >        SetEnv ADMINOS False
> > > > > </VirtualHost>
>
> > > > > Graham pointed me also, that SetEnv doesn't work with 
> > > > > os.environmodpythonprocessess (as in themodpythonFAQ is wrote), but 
> > > > > djangomodpythonhandler has workaround for this.
>
> > > > > Both applications in checks in theirs settings.py
> > > > > os.environ('ADMINOS') and set some variables depending on it.
> > > > > Unfortunately, sometimes - it is very difficult to reproduce and
> > > > > undetermistic - the second one (bluszcz.coke) get value (ADMINOS) from
> > > > > VirtualHost Admin. I set PythonInterpreter (IMVHO) propertly. Any one
> > > > > has idea what is happening?
>
> > > > > Any help would be appreciat.
>
> > > > > Cheers,


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to