By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,538 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,538 IT Pros & Developers. It's quick & easy.

simple script using CGIHTTPServer?

P: n/a
Let's say I've got the following little script called test1.py:

print "Content-type: text/html\n\n"
print "<html><body>"
print "<h1>Hello World</h1>"
print "</body></html>"

I want to run a script that takes advantage of CGIHTTPServer so that I
can send a browser to http://localhost:8081/test1.py and see the
results of the script above. What's the shortest such script that I
need to make this work? After some web searching, I found
http://manatee.mojam.com/~skip/python/web-server.py and
http://www.doc.ic.ac.uk/~tb100/proje.../standalone.py but
couldn't get either to work.

thanks,

Bob
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"philregion" <bo**********@lexisnexis.com> wrote:
Let's say I've got the following little script called test1.py:

print "Content-type: text/html\n\n"
print "<html><body>"
print "<h1>Hello World</h1>"
print "</body></html>"

I want to run a script that takes advantage of CGIHTTPServer so that I
can send a browser to http://localhost:8081/test1.py and see the
results of the script above. What's the shortest such script that I
need to make this work?


You don't need a script at all. Create a directory called cgi-bin. Copy
your script to that directory. From the directory that CONTAINS cgi-bin,
run this:

python /python23/lib/CGIHTTPServer.py 8081

adjusting the path accordingly.

Send your browser to http://localhost:8081/cgi-bin/test1.py.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.