[Web-SIG] PEAK now provides various WSGI gateway and server options
Phillip J. Eby
pje at telecommunity.com
Fri Oct 8 01:21:32 CEST 2004
The CVS version of PEAK now offers three options for running WSGI
applications: CGI, FastCGI, and SimpleHTTPServer. For example, this command:
peak launch WSGI import:my_app.application
will do this:
1. Import 'application' from 'my_app', treating it as a WSGI application
2. Start a SimpleHTTPServer listening to an arbitrary port on 'localhost'
3. launch a browser window pointing to that local server
So, it's a pretty easy way to test and play with WSGI applications without
needing to configure a web server or mess with CGI.
PEAK also includes a CGI/FastCGI gateway that auto-detects whether it's
running under CGI or FastCGI; the equivalent command is:
peak CGI WSGI import:my_app.application
But you would normally turn this into a shell script, e.g.:
#!/bin/sh
peak CGI WSGI import:my_app.application
that would then be used as the CGI or FastCGI application executable.
Finally, PEAK also offers an advanced FastCGI "supervisor" that's a
compelling replacement for mod_fastcgi's process manager when running
high-volume and slow-starting applications. It handles its own forking and
killing off of child processes when they become too idle, and it has better
"knowledge" of when new processes should or shouldn't be started.
All of these containers are fairly stable, with some of them having been
used in production for over a year now. (Until now, of course, the
interface they used was a predecessor of the current WSGI spec, and they
now use a simple adapter (courtesy of the wsgiref library) to wrap
WSGI-compliant objects such that they implement that older, more CGI-like
interface.)
In addition to these server and gateway implementations, all of PEAK's
web-based tools including the peak.web application framework, the 'DDT'
(Document-Driven Testing) toolkit, and various example applications, are
now all WSGI applications, and should in principle be able to run under
other WSGI-compliant servers and gateways, once you write an appropriate
startup script to instantiate them.
Information about PEAK can be found at
http://peak.telecommunity.com/. PEAK's server and gateway implementations
are based on the 'wsgiref' library, which is distributed bundled with PEAK,
as well as in a separate distribution.
More information about the Web-SIG
mailing list