[Tutor] Apache, CGI-BIN, Python

Ryan silas428 at gmail.com
Sun Sep 9 21:26:56 CEST 2007


I am running a Linux box and cannot find my Apache cgi-bin to put some 
python scripts in. I know I probably have to create one but don't know 
where and how.

Also on my windows machine,where I do have the bin, and normally 
everything works fine except:

#!c:/Python25/python
import cgi

reshtml = """Content-type: text/html\n\n"
<html>
<head><title>Hello Python</title></head>

<body>
<h1>Welcome To A Python Script!</h1>
</body>
</html>"""

form = cgi.FieldStorage()

#This is where everything goes wrong
#I get error messages for either the lastname line or firstname

lastname = form['lastname'].value
firstname =form['firstname'].value
message = firstname + " " + lastname
print reshtml % message


More information about the Tutor mailing list