473,322 Members | 1,703 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,322 software developers and data experts.

using CGIHTTPserver to test html forms

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


Jul 18 '05 #1
3 3309
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

Jul 18 '05 #2
I'll try it and let you know.

Thanks,

Bill

"bblochl" <bb*****@fh-lausitz.de> wrote in message
news:ma**************************************@pyth on.org...
William D. Gill schrieb:
I use a notebook (win 98) because of its portability. Unfortunately it isvery slow. When I try to develop and test python cgi scripts I use Xitamias 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 toedit 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 saysit'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

Jul 18 '05 #3
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

"William D. Gill" <wm****@gcgroup.net> wrote in message
news:30***************************@msgid.meganewss ervers.com...
I'll try it and let you know.

Thanks,

Bill

"bblochl" <bb*****@fh-lausitz.de> wrote in message
news:ma**************************************@pyth on.org...
William D. Gill schrieb:
I use a notebook (win 98) because of its portability. Unfortunately it isvery slow. When I try to develop and test python cgi scripts I use Xitamias a local server, but with python, Xitami, and my text editor running itbecomes next to impossible to work. The keyboard and mouse are slowed topainful levels. Actual execution of the webpage/script is tolerable,
but
toedit 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 saysit'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


Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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,...
1
by: philregion | last post by:
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...
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...
1
by: Sullivan | last post by:
When I run a CGI script (Python) with Python's CGIHTTPServer, it should run with the UID of the user 'nobody' (as the documentation says). But if I let the CGI script e.g. create a file, it...
1
by: Thomas Guettler | last post by:
Hi, The CGIHTTPServer returns self.send_response(200, "Script output follows") before it starts the cgi process. This means you cannot set the status header to 302 for a redirect.
4
by: Carl | last post by:
When using 'name' in the form, it works, when using 'id' it doesn't. Any comments about this? By the way, is this a good method or is it better to use 'getElementById'? Carl <body> <form...
1
by: Alvin A. Delagon | last post by:
I'm a simple python webserver based on CGIHTTPServer module: import CGIHTTPServer import BaseHTTPServer import SocketServer import sys import SQL,network from config import * class
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
1
by: mpc | last post by:
hello, how does one run a PHP page with a python webserver? Lets say i have a simple python web server running /path/webserver.py #!/usr/bin/env python from BaseHTTPServer import HTTPServer...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.