Bruce Eckel example / CGI server for localhost for Windows XP possible?

  • Thread starter Will Stuyvesant
  • Start date
W

Will Stuyvesant

Bruce Eckel has a good article about using a browser as UI for
applications you write:

http://mindview.net/WebLog/log-0045

His example code is nice, he sets up a webserver *and is able to kill
it too via a HTML button*. But his webserver does not do CGI. I have
been trying to change the code with CGIHTTPRequestHandler and other
such things, I have also tried various "recipes" for CGI webservers,
but I can not get something that works well enough. Could well be
that my poor programming skill is to blame here. Especially handling
POST is important (if a user inputs a file via HTML <input type="file"
/> then you don't want the whole file in the URL location bar. I have
a version that handles the first POST but crashes on subsequent POSTs.
So now I just use the Apache CGi webserver, but this means that if I
want to give somebody else my CGI program they also have to install
Apache.

Is there anybody who can provide simple example code like found in
Fredrik Lundh's Python Standard Library book for setting up a CGI
server for localhost with Python? Perhaps the examples that are
available work on linux, but not on my Windows XP laptop with Python
2.3.3: GET works and the first POST works too, subsequent POSTs crash.
 
I

Irmen de Jong

Will said:
Is there anybody who can provide simple example code like found in
Fredrik Lundh's Python Standard Library book for setting up a CGI
server for localhost with Python?

Not sure if this helps, but do you require a CGI style server?
Does it need to be extremely small and simple (though that's relative)?
If not, and servlet-style intelligent web applications also suit
your needs, you might be able to pick one of Python's web frameworks
and just run that on your local machine. Most won't need Apache.

At least, mine doesn't: Snakelets http://snakelets.sourceforge.net

I've heard from one user that he's using Snakelets to run a
web application off a CD-ROM...
(try an older Snakelets version <1.20 for that).

Good luck
--Irmen de Jong.
 
P

PiedmontBiz

de Jong website great.
I get errors though when I click any link.
""""""
Exception in server
Page "/index2.y" caused an error: session is transported to different remote
address
Traceback (innermost last):
File "/home/promozilla/Server/snakeserver/webapp.py", line 410, in
run_Ypage_GET
self.pageEngine.addPageVars(page, self, req, resp)
File "/home/promozilla/Server/snakeserver/YpageEngine.py", line 123, in
addPageVars
session=webapp.addSessionCookie(request,response)
File "/home/promozilla/Server/snakeserver/webapp.py", line 486, in
addSessionCookie
session.setRequestData(request,response)
File "/home/promozilla/Server/snakeserver/websession.py", line 31, in
setRequestData
raise ValueError("session is transported to different remote address")
ValueError: session is transported to different remote address

"""
 

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

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top