Unified web API for CGI and mod_python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Chase

    #1

    Unified web API for CGI and mod_python?

    I've been digging around, but can't seem to come up with the
    right combo of words to google for to get helpful results. Is
    there some handy wrapper/module that allows code to target
    existance as both a CGI script and a mod_python script, with only
    one "import" statement? Perhaps some common object model?

    I've got CGI access on one server, and mod_python on
    another...I'd prefer to use mod_python for the reduced overhead
    (my own performance testing seems to indicate it's got a good
    lead over CGI), but it's not as available on various hosting
    services as CGI access is.

    Thanks,

    -tkc





  • Paul Boddie

    #2
    Re: Unified web API for CGI and mod_python?

    Tim Chase wrote:[color=blue]
    > I've been digging around, but can't seem to come up with the
    > right combo of words to google for to get helpful results. Is
    > there some handy wrapper/module that allows code to target
    > existance as both a CGI script and a mod_python script, with only
    > one "import" statement? Perhaps some common object model?[/color]

    You could try WebStack - it provides a common API which would probably
    be suitable for your purposes:



    The PythonInfo Wiki [1] has a WebProgramming page which also gives
    information about the different frameworks and standards.

    Paul

    [1] http://wiki.python.org/moin/

    Comment

    • Tim Chase

      #3
      Re: Unified web API for CGI and mod_python?

      >> I've been digging around, but can't seem to come up[color=blue][color=green]
      >> with the right combo of words to google for to get
      >> helpful results. Is there some handy wrapper/module
      >> that allows code to target existance as both a CGI
      >> script and a mod_python script, with only one "import"
      >> statement? Perhaps some common object model?[/color]
      >
      > You could try WebStack - it provides a common API which
      > would probably be suitable for your purposes:
      >
      > http://www.python.org/pypi/WebStack[/color]

      Paul,

      I meant to thank you (even if I already have) for this link
      as it's just what I've been looking for. Thanks!

      I've had some trouble installing it on one of my boxes and
      was hoping you might be able to tell me where I've gone awry:

      It's a Debian/Testing box with Apache 1.x running with both
      CGI and mod_python enabled for testing purposes (my aim is
      to make use of at least the CGI, mod_python, and
      BaseHTTPRequest Handler).

      When I run the setup.py script (either as myself or as root)
      I get back


      root@rubbish# cd ~tim/WebStack-1.1.2
      root@rubbish# python2.3 setup.py install
      running install
      error: invalid Python installation: unable to open
      /usr/lib/python2.3/config/Makefile (No such file or directory)



      Now this makes sense, as I don't have a config/ in my
      /usr/lib/python2.3 directory. However, I've not had trouble
      with any other packages (though everything else has been
      added via apt-get, not via setup.py files). Is this a file
      that should be there? If so, where would I go about finding
      it? If not, is there a simple way to do an install without
      setup.py (or to tell setup.py to "get over it")? Or is
      there a Debian repository with a .deb package for it that I
      can point at (I noticed you may have some Debian sort of
      leaning while hunting through the help)?

      Push come to shove, it would be possible to manually copy
      files to their associated locations: docs and apidocs to a
      WebStack directory in /usr/share/docs, and the WebStack
      python files to /usr/lib/python2.3/WebStack ...is there
      anything else I'm missing here?

      Thanks,

      -tim









      Comment

      • Alexis Roda

        #4
        Re: Unified web API for CGI and mod_python?

        Tim Chase escribió:[color=blue]
        >
        > root@rubbish# cd ~tim/WebStack-1.1.2
        > root@rubbish# python2.3 setup.py install
        > running install
        > error: invalid Python installation: unable to open
        > /usr/lib/python2.3/config/Makefile (No such file or directory)
        >[/color]

        apt-get install python2.3-dev


        HTH

        Comment

        • Tim Chase

          #5
          Re: Unified web API for CGI and mod_python?

          >>root@rubbis h# cd ~tim/WebStack-1.1.2[color=blue][color=green]
          >>root@rubbis h# python2.3 setup.py install
          >>running install
          >>error: invalid Python installation: unable to open
          >>/usr/lib/python2.3/config/Makefile (No such file or directory)[/color]
          >
          > apt-get install python2.3-dev[/color]

          Worked like a charm, and the WebStack install took place
          uneventfully. Only took half an hour to download the .deb
          packages over dialup :-/

          Thanks for your help!

          -tim




          Comment

          Working...