[mod_python] Re: Persistant data

Russell Yanofsky rey4 at columbia.edu
Wed Dec 17 20:16:40 EST 2003


Timothy Stebbing wrote:
> Is there some way to persist data resource using apache? Im writing a
> simple protocol module
> using PythonConnectionHandler, this takes queries and runs them
> against various backends,
> ie postgres, Lupy (indexer), etc. I want to persist my connections to
> these resources across all
> requests.
>
> Ive tried adding a db 'pool' into a module, but the module is reloaded
> for each request serviced.

Is the module containing the db pool the same one that you specified in
PythonConnectionHandler? If so, you should try storing the pool in a
different module and accessing it with an import statement.

> Im wondering if there is some way I can add objects into these 'apache
> tables' ? would that make
> them persistant, and if so how do I do that? I was also wondering if I
> could somehow access the
> main namespace from child interpreters?

I doubt Mod_Python is using a different interpreter for each request. It's
probably just reloading the one module.

- Russ




More information about the Mod_python mailing list