[mod_python] handling multiple users with mod_python

Graham Dumpleton graham.dumpleton at gmail.com
Tue Apr 17 01:07:36 EDT 2007


On 17/04/07, Prashanth <prashanth.dumpuri at vanderbilt.edu> wrote:
> All,
>   I have just started getting into web design and programming. I have to
> create a web page that can handle multiple logins/users. After logging
> in, the website has to cater to the individual needs of each user.
>
> index.html - main interface page that has a login prompt.
> login.py - verifies the authenticity of the user.
> After logging in, the user is directed to the "jobs" page
> job1.html and job1.py, job2.html and job2.py .... jobN.html and jobN.py
> - the html scripts accept files from the user and run the jobs described
> in the associated python scripts.
> Results.html - page where the users can download the results from the
> above python scripts.
>
> Since the results will be different for different users, I have to keep
> track of the users that login to the webpage and direct them
> accordingly. How do I pass the username from login.py to job1.py ?
>
> (I created multiple usernames and passwords using .htpasswd. I'm using
> mod_python 3.3 and apache 2.0.59).

You probably need some form of web server session management:

  http://en.wikipedia.org/wiki/Session_management#Web_Server_Session_Management

At the lowest level this is usually managed using browser cookies, or
forms of URL rewriting.

In mod_python you want to look at the Session class:

  http://www.modpython.org/live/current/doc-html/pyapi-sess.html

as an implementation of a cookie based system.

Graham


More information about the Mod_python mailing list