using CGIHTTPserver to test html forms
bblochl
bblochl at fh-lausitz.de
Mon Feb 23 10:50:53 EST 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.
>
>Thanks
>
>Bill
>
>
>
>
>
>
#httpd.py
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
serveradresse = ("",8080)
server = HTTPServer(serveradresse, CGIHTTPRequestHandler)
server.serve_forever()
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
python httpd.py
The html-files must be in the same directory a s the file httpd.py.
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 127.0.0.1:8080/name.html)
in the browser adress line.
Best regards and good luck!
Bernhard
More information about the Python-list
mailing list