Python CGI programming

Gerhard Häring gerhard.nospam at bigfoot.de
Thu Feb 1 17:36:57 EST 2001


Your Python code is ok. Assuming the Python interpreter really is at
/usr/bin/python. If not, you must adjust the first line of the script to
point to the location of the python interpreter. Another common place
would be /usr/local/bin/python.

First you should find out if the webserver supports user CGI scripts at
all. If it does, these must normally be put in a directory named
cgi-bin, like ~/home_html/cgi-bin. The script must also have the
executable bit set (assuming you are on Unix, of course).

chmod +x feedback.py    sets the executable bit of your script.

Gerhard

seung-won hwang wrote:
> 
> FYI, when I type the following example, web browser just shows
> the source code..not the test string... How can I fix this?
> 
> #!/usr/bin/python
> 
> # Tell the browser how to render the text
> print "Content-Type: text/plain\n\n"
> 
> print "Hello, Python!"  # print a test string

-- 
Sorry for the fake email, please use the real one below to reply.
contact: g e r h a r d @ b i g f o o t . d e
web:     http://highqualdev.com



More information about the Python-list mailing list