[mod_python] Persistent Database and Publisher problem

Mike Verdone mike_verdone at shaw.ca
Wed Jan 8 18:04:11 EST 2003


I'm having some trouble using the persistent database example code from the 
FAQ and the publisher handler. The problem is that the persistent connection 
is not actually persistent. Instead, it connects on every request, and does 
not disconnect.

I put the database code in a file _database.py, and then I put all the 
database functions into a file _dbcommands.py. The problem is, how do I 
import _database in _dbcomands?

If I use:

import _database

then it make a new connection on every request. I figure that the correct way 
to do it is using the PythonImport apache directive, but the problem now is 
that I can't see the imported module when running through the publisher 
handler. i.e. this doesn't resolve without import _database:


I ensured that that _database is being imported by the interpreter (8 
connections are made before any requests), and the module is imported in the 
correctly named interpreter. I suspect the module is "blocked" by 
publisher-handler. Is that the problem?

Any recommendations on how to get around this?


More information about the Mod_python mailing list