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

Trond tamyk at
Sun Jul 18 21:10:03 CEST 2004

It works, that is, the module is initiated once, but a copy of the
module is created for each it doesn't really solve my
memory problem. Maybe I've done something wrong, or maybe it just
isn't possible for 10 threads to use the same copy of the module?

Michael Ströder <michael at> wrote in message news:<jhmos1-pn1.ln1 at>...
> 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/
> > 
> > bigdict = {}
> > 
> > On the first request to your app, start a new thread with a reference to
> > that module; subsequent imports will find 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