mod_python: How to make a single object available to allinstances?
Robert Brewer
fumanchu at amor.org
Sun Jul 18 16:19:46 EDT 2004
Michael Ströder wrote:
> 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?
I'm not an expert on Apache or mod_python by any means. The above technique works on Apache 2 on my Win2k box. Y'all should probably ask Grisha on the mod_python list...
Trond, are you using Apache 1 or 2?
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list