[mod_python] MySQL Session implementation?

Jim Gallacher jpg at jgassociates.ca
Mon Jun 19 17:49:03 EDT 2006


Sébastien Arnaud wrote:
> Hello to all,
> 
> I was wondering if anybody had worked on a clean integration of MySQL 
> for session storage in opposition to the default local db file 
> mp_session that gets written in /tmp
> 
> I have wrote a nice little web based app last year using mod_python and 
> now the traffic is so that it is in a load balancing configuration, but 
> the LB does not seem to work very well and "stick" a specific client to 
> a specific server, which is causing users to get logged out of the app.
> 
> Anyway, before I decided to start to reinvent the wheel here, I thought 
> I would ask, since it seemed to me like the easiest way to share the 
> sessions across multiple webapp servers would be to extend the 
> mod_python Session class to use a DB connection such as MySQL.

Nicolas wrote an experimental SQLite backend which would likely be a 
good starting point for you. Take a look at:
http://svn.apache.org/viewvc/httpd/mod_python/branches/nlehuen/sandbox/SQLiteSession.py

> Also, is there a way to rename the python session cookie as of 3.2.8?

PythonOption session_cookie_name your-cookie-name

This was added in 3.2.

Jim



More information about the Mod_python mailing list