[mod_python] A question about running 2 apps with mod_python

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jan 16 19:52:13 EST 2008

On 17/01/2008, Chris Guin <cguin at bbn.com> wrote:
> Thanks for the response!
> My httpd.conf was not set up to use VirtualHosts at all - it simply
> uses different Location defintions, separated by distinct
> PythonInterpreter directives, to send URLs to the correct Django
> application.  Just to make sure there wasn't some arcane httpd
> feature that required the definition of at least 1 VirtualHost, I
> enclosed all my Location definitions in one VirtualHost and restarted
> httpd to no avail.  (httpd -S seemed to like my VirtualHost
> definition, so I know it is at least syntactically correct).
> The problem is still largely random, but only seems to occur when 20
> or more users are logged in, and can sometimes be fixed by restarting
> httpd.  The Django documentation suggests that httpd.worker should
> not be used, but without giving any reason for it.  It may be that my
> problem is more Django related than mod_python related, so I'll see
> what if anyone on the boards over in Django land can help.

Use of worker MPM shouldn't have anything to do with it.

Am a bit overloaded at the moment so don't have time to really dig
further, so only quick thing I can suggest is to use mod_wsgi instead
and delegate your separate applications to run in separate daemon
process groups using its daemon mode. Or, if one is more important
than the other, continue to run it in embedded mode and run the others
in daemon mode.

This way each application is in a separate set of processes and if it
is a problem with mod_python/Python in some way, it shouldn't occur
again because of the different way that mod_wsgi works. If it does
still occur, then it has to be an issue with your Apache configuration
or something to do with page caching in Apache, a proxy or the
browser, although nothing should cache 404 pages.


> Thanks,
> Chris Guin
> At 06:15 PM 1/15/2008, you wrote:
> >Have you defined NameVirtualHost directive properly. Lack of this
> >directive when using multiple VirtualHost definitions is normally the
> >cause of such mixing of site pages.
> >
> >Graham
> >
> >On 16/01/2008, Chris Guin <cguin at bbn.com> wrote:
> > > We've recently switched to using worker mpm instead of prefork, and
> > > things have mostly been going smoothly.  Our server is running 2
> > > Django applications, one of which is forum software.  Their URL
> > > spaces are entirely distinct, and each "Location" in httpd.conf has
> > > been set to use one of two different PythonInterpreters depending on
> > > the app it services.
> > >
> > > We've noticed that regular accesses to the forum pages will randomly
> > > (about 50% of the time) call up the 404 page for the other
> > > application.  We've noticed no similar problems in the reverse
> > > direction (from the other app to the forums).  Refreshing the 404
> > > page eventually gets us to the forum.
> > >
> > > The randomness of the error suggests to me that it has to do with
> > > which httpd.worker process or thread is picking up the request, but I
> > > can't explain what difference it would make.  Since we have switched
> > > to worker from prefork, I suspect this may be at fault somehow.
> > >
> > > Any insight would be tremendously appreciated!
> > >
> > > Chris Guin
> > >
> > >
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > > http://mailman.modpython.org/mailman/listinfo/mod_python
> > >

More information about the Mod_python mailing list