using CGIHTTPserver to test html forms

W

William D. Gill

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
 
B

bblochl

William said:
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
 
W

William D. Gill

I'll try it and let you know.

Thanks,

Bill

bblochl said:
#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
 
W

William D. Gill

Sorry it took so long to get back. That worked fine.

I may wrap things up in something like the pydocgui so that I can select
different documents, and shut it down more gracefully. If I do, I'll post
the code.

Thanks again,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top