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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Will Stuyvesant

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

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



    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 CGIHTTPRequestH andler 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.
  • Irmen de Jong

    #2
    Re: Bruce Eckel example / CGI server for localhost for Windows XPpossible?

    Will Stuyvesant wrote:[color=blue]
    > 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?[/color]

    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.

    Comment

    • PiedmontBiz

      #3
      Re: Bruce Eckel example / CGI server for localhost for Windows XP

      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(pa ge, self, req, resp)
      File "/home/promozilla/Server/snakeserver/YpageEngine.py" , line 123, in
      addPageVars
      session=webapp. addSessionCooki e(request,respo nse)
      File "/home/promozilla/Server/snakeserver/webapp.py", line 486, in
      addSessionCooki e
      session.setRequ estData(request ,response)
      File "/home/promozilla/Server/snakeserver/websession.py", line 31, in
      setRequestData
      raise ValueError("ses sion is transported to different remote address")
      ValueError: session is transported to different remote address

      """

      Comment

      Working...