Example how to use cgihttpserver

Moshe Zadka moshez at math.huji.ac.il
Sat Jul 1 07:12:07 EDT 2000


On Fri, 30 Jun 2000, Peter Mueller wrote:

> Hi,
> 
> is there an example how to use the cgihttpserver in a way that some cgi
> scripts are in /cgi-bin/* (this is simple) and others are coded in the
> program itself. A simple example reading the FieldStorage, generating a
> page ... would me help very much.

The trick is to use (for the hard-coded "cgi" scripts) the cgi module with
non-default parameters: instead of os.environ, use a special dictionary,
and instead of sys.stdin, use self.rfile. You'll have to hack something
up, and I'm not aware of any ready made examples, but this should give 
you enough to go on.
--
Moshe Zadka <moshez at math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.





More information about the Python-list mailing list