Small, Local Web/CGI Server Advice

Alex Martelli aleaxit at yahoo.com
Wed May 30 16:15:39 CEST 2001


"Sloth" <mt_horeb at yahoo.com> wrote in message
news:67abb823.0105300435.260f47d2 at posting.google.com...
> I'm attempting to create my first major Python app for a company that
> wants to run Web (HTML) pages and CGI scripts on their salespeople's
> laptop computers.  Basically, the salesperson would run a local Web
> server that allows for basic CGI scripts to be run.  The customer is
> pushing hard that they want to use their Web browser as the client and
> to have a local server serving CGI/HTML that also is running on that
> laptop (that wouldn't have been my first choice, but those are the
> constraints I'm working with...)

I think these guys have a VERY good idea, actually.  This way
their salespeople can switch from local (perhaps not-latest)
data to accessing live data whenever they can plug their laptops
to the net.


> I've tried to use CGIHTTPServer, but I am having problems getting that
> to work on Windows ME/98 (using ActiveState Python 2.1 - HTML is
> served just fine, but CGIs cause EXPLORER to crash).  Any advice on a
> small, preferably Python based Web server that I can run that will
> support CGI?

It's not Python based, but Xitami, http://www.imatix.com/html/xitami/,
is what I ended up for a similar need (I don't recall CGIHTTPServer
giving trouble, either -- once I had ensured w9xpopen.exe was in all
the right places, python run with -u, etc, of course; but Xitami was
better).  Runs on everything from Windows 3.1 up, installs like a
snap, is VERY lightweight, almost no admin (and that little, web-
based), virtual hosts, SSI... as well as CGI, it supports LRWP, 'long
running web processes', designed by Robin Dunn (see, we *HAVE* a
Python connection!-), similar to FastCGI but simpler, includes a
lrwplib Python extension allowing very easy use, example given:

from lrwplib import LRWP

def main():
    lrwp = LRWP('hello', 'localhost', 81)
    lrwp.connect()
    count = 0
    while count < 5:        # exit after servicing 5 requests
        count = count + 1
        req = lrwp.acceptRequest()
        req.out.write('Content-type: text/html\r\n\r\n')
        req.out.write('<HTML><HEAD><TITLE>hello</TITLE><')
        req.out.write('</HEAD>\n')
        req.out.write('<H2>Hello from LRWP</H2>\nCount = ' + str(count))
        req.out.write('\n</BODY></HTML>\n')
        req.finish()

    lrwp.close()

if __name__ == '__main__':
    main()


> I'd love to use something like Medusa if I could figure
> out how to get it to support CGIs.  I really don't want to use a
> 'large' server like Apache, since I'm really just trying to run a
> lightweight server.
>
> Any advice would be GREATLY appreciated!!!

I'm sure you can get CGIHTTPServer to work.  But it might
not be quite as lightweight as Xitami+LRWP... give it a try!


Alex






More information about the Python-list mailing list