server wide variables

Graham Dumpleton Graham.Dumpleton at gmail.com
Tue Jun 26 02:29:48 CEST 2007


On Jun 26, 1:29 am, Jay Sonmez <meti... at gmail.com> wrote:
> I want to be able to save some server variables as long as Apache runs
> on the server (mod_python).
>
> How is that possible in Python?

It depends on whether you expect all Apache child processes for that
server to be able to access the data and for the data to be able to
survive the killing off and start up of individual Apache child
processes.

For background on some of the issues read:

  http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel

Saving data in os.environ is not recommended even if they have to
survive just within the context of that specific interpreter within
that process, as os.environ access and update is not thread protected
and Apache child processes may be multithreaded.

So, read that referenced document and then perhaps explain you
expectations a bit better.

Graham




More information about the Python-list mailing list