Newbie: Where to start with cgi?

root husam at
Wed Jun 18 19:02:24 CEST 2003

> Take a look at mod_python.

Thanks for the replies,

I went through webware and mod_python and I think they are indeed the 
stuf that I need. But which one should I choose? I really don't know. 
Any way, I started with mod_python this morning and the test scripts 
worked find by displaying "hello world". But, when I followed the 
tutorials on I got stuck at a nother test script provided 
by the tutrial. After 4 hours of trying still no go because the test 
scripts are either don't work, or misunderstood by me.

These are the configurations:

<Directory /var/www/html>
     AddHandler python-program .py
     PythonAuthenHandler form
     PythonHandler form
     PythonDebug On
     AuthType Basic
     AuthName "Restricted Area"
     require valid-user


from mod_python import apache

def handler(req):
     req.content_type = "text/html"
     req.write("Welcome ")
     return apache.OK

def authenhandler(req):

     user = req.user
     pw = req.get_basic_auth_pw()

     if user == "newbie" and pw == "python":
         return apache.OK
         return apache.HTTP_UNAUTHORIZED


   <meta http-equiv="content-type"
  content="text/html; charset=ISO-8859-1">
Name:<input type="submit" name="Login">

When form1.html is called the server generates this error:

Server error!

The server encountered an internal error and was unable to complete your 
request. Either the server is overloaded or there was an error in a CGI 

If you think this is a server error, please contact the webmaster
Error 500

     Wed 18 Jun 2003 06:58:07 PM CEST
     Apache/2.0.40 (Red Hat Linux)

More information about the Python-list mailing list