Sloooooowwwww WSGI restart
Graham.Dumpleton at gmail.com
Thu Jan 29 14:00:06 CET 2009
On Jan 29, 8:15 pm, Aleksandar Radulovic <a... at a13x.net> wrote:
> On Thu, Jan 29, 2009 at 1:16 AM, Graham Dumpleton
> <Graham.Dumple... at gmail.com> wrote:
> > Sorry, you are wrong to assume that an Apache restart is not be
> > required.
> > If you are usingmod_wsgiembedded mode, or mod_python, then a code
> > change will always require a full restart of Apache.
> I am running several middleware apps I'm working on under mod_python
> (simple setup using mod_python.publisher handler) and so far, haven't
> had the reason to restart apache at all.
The automatic module reloading in mod_python when using
mod_python.publisher only applies to the publisher code files or those
imported via the mod_python module importer and which is also a
candidate for reloading.
Basically, any module or package installed on sys.path is not a
candidate for reloading. Thus if you installed your code outside of
your document tree in a directory in sys.path and those code files
were changed, then no automatic reload would occur.
For further information see documentation for import_module() in:
In other words, it is not universal that any code change will be
automatically detected and a reload occur. There are also various
caveats on what mod_python module importer does, as it is reloading
modules into an existing process and not restarting the whole process.
If you are not careful, weird things can happen.
> > Thus, the conjecture that Apache/mod_wsgicannot be used and that
> > CherryPy WSGI server or Paster server must be used when developing a
> > Python web application is false. If usingmod_wsgithen daemon mode
> Not sure what (or whom) you're referring to.
It was a general statement. There are various people on different
forums and irc channels who keep saying that a full Apache restart is
required with Apache/mod_wsgi when making code changes. Am just
stating for the record that that isn't true.
> IMO, developing TG/Pylons/Django
> apps is much convinient with embedded web server (cherrypy or paster) as
> it is possible to do rapid development without resorting to restarts.
In the case of Django, it uses a single non threaded process, thus is
not an adequate test of either a multithread or multiprocess
environment. Something which Apache/mod_wsgi provides.
CherryPy WSGI server although it provides multithreading doesn't have
a multiprocess option and it itself doesn't have a reload feature but
depends on some layer on top to manage that from what I remember.
So, depends on how closely you want your development environment to
mirror production so that issues are picked up sooner, rather than
only at the point of deployment to a production system when you are
More information about the Python-list