[mod_python] inithandler?

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Sep 17 22:59:18 EST 2001

There is a PythonImport, which essentially does this. It has some severe

The thing is that mod_python will create separate subinterpreters for
separate virtual servers (or optionally directories), but the only
opportunity to learn this information is during request procesing.

At Apache startup time you can't tell what the subinterpreters will be.
You have an option of manually giving interpreters names and making sure
that PythonImport executes under a specific name, but it's just kind of

I understand what the problem is, but  can't think of a clean solution to


On Tue, 18 Sep 2001 harm at millionmonkeys.nl wrote:

> Moi,
> first of all thanks for mod_python. I come from an (mod_)perl world and the
> python version definitely is the easier one to use (There are tons of traps
> you have to watch out for under mod_perl).
> Anyway. My tiny question.
> Why is there no init handler? It would run the moment the python
> interpreter gets loaded/intiated by the freshly forked apache. It would be a
> nice place to initialise some site global modules.
> Sure, I could do a:
> if not mypersistentvar:
>    mypersistentvar = Some.Nice.Object()
> but an InitHandler does look like cleaner to me.
> Any better way to arrange initialisation than the above method?
> Thanks,
> Harmen
> --
>                                                          The Moon is New
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list