[mod_python] handling multiple users with mod_python

Jorey Bump list at joreybump.com
Tue Apr 17 13:07:31 EDT 2007

Prashanth 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).
> Any help in this regard will be greatly appreciated.

Judging by your description, you can create the entire application in a 
single file, such as jobs.py. Handle your logic in that file and simply 
branch according to the GET, POST, or session variables. Scattering this 
across multiple pages will only complicate things. Certainly you can 
keep your jobN information in some kind of structure or database?

More information about the Mod_python mailing list