using CGIHTTPserver to test html forms

bblochl bblochl at
Mon Feb 23 16:50:53 CET 2004

William D. Gill schrieb:

>I use a notebook (win 98) because of its portability.  Unfortunately it is
>very slow.  When I try to develop and test python cgi scripts I use Xitami
>as a local server, but with python, Xitami, and my text editor running it
>becomes next to impossible to work.  The keyboard and mouse are slowed to
>painful levels.  Actual execution of the webpage/script is tolerable, but to
>edit I have to stop the server.  I was wondering if using CGIHTTPserver
>would be a better solution and if anyone can give me an example script
>(simple enough for a newbie).  Every reference I see to CGIHTTPserver says
>it's good for testing your web forms, but they don't show me how.

from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
serveradresse = ("",8080)
server = HTTPServer(serveradresse, CGIHTTPRequestHandler)

I have tried that on Win2k starting in the editor Window of IDle and 
Python will hang. (On other systems it works ok - I have not found the 
reason yet!) On my linux- system I have no problems of that kind. On a 
Windows-network I couldn`t get it to work at all.

On my test-sytem (Win2k) it works well, if you start it from a 
DOS-Window from the DOS-Prompt by typing
The html-files must be in the same directory a s the file 
cgi-files must reside in a subdirectory namend cgi-bin.

To test for instance the html-file name.html, you start the local server 
by typing http://localhost:8080/name.html  (or 
in the browser  adress line.

Best regards and good luck!

More information about the Python-list mailing list