[mod_python] How mod_perl does Imports vs mod_python

Jack Diederich jack_diederich at email.com
Mon Jul 29 23:24:42 EST 2002

Followup to my earlier post about slow init times.
mod_perl only has one interpreter.  It processes
imports as the last thing before leaving the apache
module init function (in mod_python, this would be

If the main interpreter exists by the end of python_init()
[I think it does, but I don't know the interpreter internals
at all] we could at least populate that with the PythonImport
directives from httpd.conf

This wouldn't solve the problem for everyone (those using
virtual hosts) but it would at least solve mine :)
Optionally to support virtual hosts there could be a directive to prespawn sub-interpreters and process the 
import directives for those too.

Can any of the mod_python authors comment?  I might be
able to try my hand at a patch in a month, but for now 
I'll just stick with my workaround (ugly combination of a 
proxy and wget)

mod_perl also has a lot of logic to differentiate between a
stop/start and a restart.  In the restart case it actually
does the import _while_ reading the config.  In the fresh
start case it waits until the end of the init function.
I don't know if you can purge or overwrite import info in
a python interpreter like you can with perl. (perl just has
one big namespace plus smaller funciton/loop/etc variables).

Use of globals and macros to access them to keep track of
information about startup, pending imports, etc.


Sign-up for your own FREE Personalized E-mail at Mail.com

Get 4 DVDs for $.49 cents! plus shipping & processing. Click to join.

More information about the Mod_python mailing list