[mod_python] Session managment for mod_python

Gregory Trubetskoy grisha at modpython.org
Sun Oct 15 17:16:53 EST 2000

On Sun, 15 Oct 2000, Damjan wrote:

> > what do you mean by session management?
> > 
> The best session managment would be a Python dictionary, that is global
> to all subinterpreters, and all Apache processes, and that retains its
> state across handlers and requests.

Let me guess - if Apache process is restarted, you would like the state to
be retained througout the restart?

> Let me illustrate what can be done with this. 


> Of course you could do this with a database and pickle-ing the user
> object. Or you could do this with a shared memory.

I think you answered your own question - this sort of thing is best done
with a database.

I see Apache (and mod_python, which is just an interface to it) as a
process responsible for serving requests, but not a database, data storage
is not one of its functions, and it is well suited for delegating that
function to a database. 

If you think about it carefully, there is a slew of issues one has to
consider to implement something like this. Locking alone could be pretty
complicated. Why bother with any of this, if something like MySQL already
does all of those things very efficiently.

Hope this doesn't dicourage you from using of mod_python. In fact writing
a mod_python handler that would provide a framework that would use a
database and work as you describe could be a very interesting project.


More information about the Mod_python mailing list