473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

simple script using CGIHTTPServer?

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
1 3536
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Preston Crawford | last post by:
I'm looking to quickly get a photo album online. Very simple, thumbnails, a few pages, maybe a description, but hopefully a small script that's easy to edit and work into my existing site. I know...
2
by: Dfenestr8 | last post by:
Hi. I'm just a hobbyist and I like mucking around with cgi scripts. Here's the script I've been using...... >#! /usr/bin/python > >import BaseHTTPServer >import CGIHTTPServer
3
by: vincent wehren | last post by:
Hi, as a small capabilities demo I coded the piece below to show how to use Python for cgi'ing on localhost and it more or less does the trick :-). However, I when I freeze it with py2exe,...
2
by: Gelo Ilzi | last post by:
I'm trying to implement a very simple http server with cgi functionality. The code is simple: import CGIHTTPServer, BaseHTTPServer httpd = BaseHTTPServer.HTTPServer(('',8000),...
6
by: pxlpluker | last post by:
i was looking at twisted but it appears to be WAY beyond my megar skills at this point. so i think CGIHTTPServer will fit my needs if it is pretty stable. I have a small python cgi that i was...
9
by: Pete | last post by:
Does anyone have a simple html vbscript or other type of snippet they can share that appends a record to a access database via ADO or DAO? I would like to allow users that don't have Microsoft...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
3
by: sophie_newbie | last post by:
Is there any way that I can pass cgi parameters to my script locally, before i upload it to the webserver, so that i can debug it. Normally I would pass parameters like this: ...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.