Web programming in Python.

Steve Holden steve at holdenweb.com
Mon Sep 29 09:39:19 EDT 2008


Kurda Yon wrote:
> 1. On my server (in my directory) I found "cgi-bin" subdirectory.
> 
> 2. In the "cgi-bin" I have created a file "test.py".
> 
> 3. In that file I put:
> #!/usr/bin/python2.4 python

OK, if /usr/bin/python2.4 really *is* a directory then you will need to
make that first line

#!/usr/bin/python2.4/python

(The phrase folowing the "#!" should be a reference to your Python
interpreter).

> print "Hello, World!"

Also, this isn't going to be adequate as an HTTP response, which a CGI
script is always supposed to provide. A minimal example would have a
single header followed by a blank like (which marks the end of the
headers) and your content, like this:

print """Content-Type: text/plain

Hello, World!
"""
> (I have checked, I have "/usr/bin/python2.4" directory.)
> 
> 4. I give the following permissions to the "test.py":
> -rwx---r-x
> 
> 5. The "cgi-bin" directory has the following permissions:
> drwx---r-x
> 
> 6. In the "cgi-bin" I have created the ".htaccess" file which
> contains:
> Options +ExecCGI
> AddHandler cgi-script .py
> 
> 
> And it still does not work! If I try to see the page by my browser I
> see:
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
> ...
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
If that doesn't get your script working then you should look at the
error logs.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list