mod_python: How to make a single object available to all instances?

Michael Ströder michael at stroeder.com
Sat Jul 17 18:41:23 EDT 2004


Robert Brewer wrote:
> 
> mod_python won't reload modules (as long as you keep *a* thread alive, I
> think); therefore, you can put your dict in a module:
> 
> # myapp/env.py
> 
> bigdict = {}
> 
> On the first request to your app, start a new thread with a reference to
> that module; subsequent imports will find env.py in sys.modules and
> won't reload, and therefore won't reinit your bigdict.

Please enlighten me under which conditions this work.
Does that also work with Apache 1.3 and worker processes? Or does it only 
work with Apache 2.0 and threads?

Ciao, Michael.



More information about the Python-list mailing list