simple script using CGIHTTPServer?

Tim Roberts timr at probo.com
Fri Mar 26 02:55:27 EST 2004


"philregion" <bob.ducharme at 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, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list