View Single Post
Old Jan 25th, 2008, 6:02 AM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,788
Rep Power: 5 Sane will become famous soon enough
Re: Running python scripts on localhost

Well I'm going to assume you have everything necessary set up... such as the web server, CGI support, placed the script in the appropriate directory, linked the .py extention to the cgi-handler, etc...

Then, your code should start off with something like:

#!c:/python24/python

import cgitb
import cgi
cgitb.enable()

print "Content-type: text/html\r"
print "\r"

Depending on your CRLF, and location of Python. My example is if the web server is on Windows, with the Python interpreter at c:/python24/python.exe.
Sane is online now   Reply With Quote