[albatross-users] FastCGI Implementation

Matt Goodall matt at pollenation.net
Thu Jun 5 10:46:37 EST 2003


Hi all,

I've finished the FastCGI support module, it's attached. It was very
easy and seems to work ok :). I've run both stateful and random apps
here although they're not very complicated.

The fcgiapp module contains the usual class, Request, and a method,
running(). I chose to extend cgiapp.Request since the implementation is
mostly identical.

The fcgiapp module uses Robin Dunn's fcgi.py, available via the FastCGI
site, http://www.fastcgi.com. Here's the direct link -
http://alldunn.com/python/fcgi.py.

To use fcgiapp, change your application startup code to:

        import fcgiapp
        app = App()
        while fcgiapp.running():
            app.run(fcgiapp.Request())

The while loop runs until running() returns 0, i.e. until the web
server's FastCGI module decides to shut you down. fcgi also supports
straight CGI so you can use the same code when running as a CGI. All
that happens for CGI is that the loop only runs once.

Tim - since you expressed an interest in this, could you try some more
realistic tests?

Dave, Andrew - If you want this, it's yours. Feel free to repackage it,
rewrite it, refactor it with cgiapp etc. Heck, you can even add some
comments if you want ;-).

Hope this is useful.

Cheers, Matt

-- 
Matt Goodall
Pollenation Internet Ltd, http://www.pollenation.net
e: matt at pollenation.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fcgiapp.py
Type: text/x-python
Size: 572 bytes
Desc: not available
URL: <http://www.object-craft.com.au/pipermail/albatross-users/attachments/20030605/0a544f6c/attachment.py>


More information about the Albatross-users mailing list