Python CGI - Session Management
Ian Bicking
ianb at colorstudy.com
Mon Jul 15 12:00:46 EDT 2002
On Mon, 2002-07-15 at 10:48, Jan Felix Reuter wrote:
> Hi,
> I'm trying to implement some session management in my website, to keep track
> of logged-in users. The site is entirely made of CGI's written in python. I
> just don't know where to start, I've looked at the Cookies module, I
> understand that allright, but where do I place the code in my CGI's?
>
> How does one do session managment in Python, anyway? Aren't there any
> modules that I have overlooked? Also, I'd like to know if there's a good
> website with resources about programming for the web with python. I google
> search didn't give me any meaningful results.
For more complex things, people often use frameworks (which usually
include some sort of sessions). Some of them are listed here:
http://www.python.org/cgi-bin/moinmoin/WebProgramming
For sessions, you'll want associate a session-ID with the user (i.e.,
set a SID cookie for the user), and then use something like shelve to
store the session information associated with that cookie. I don't know
of anything to do this for you, but then I'd also be surprised if
something for CGI didn't exist somewhere.
Ian
More information about the Python-list
mailing list