wsgitools

overview #

wsgitools is a set of tools working with WSGI (see PEP 333). It includes classes for filtering content, middlewares for caching, logging and tracebacks as well as two backends for SCGI. Goals in writing it were portability and simplicity.

getting wsgitools #

You can either download version 0.2.4 or get the latest version from the git repository. Just type git clone git://git.subdivi.de/~helmut/wsgitools.git. The source is also exported using gitweb.

documentation #

Modules are documented using docstrings, so there is an epydoc export.

example #

Most often a simple example is useful. Well here is one:

import sys
from wsgitools.applications import StaticContent
from wsgitools.middlewares import TracebackMiddleware
from wsgitools.filters import WSGIFilterMiddleware, RequestLogWSGIFilter
from wsgitools.scgi.asynchronous import SCGIServer

app = StaticContent("200 OK", [("Content-type", "text/plain")],
    """Serving really simple static content as plaintext.""")

# serve a traceback when catching exceptions
app = TracebackMiddleware(app)

# log requests in apache log file format to stdout
app = WSGIFilterMiddleware(app, RequestLogWSGIFilter.creator(sys.stdout))

# run a scgi server on localhost:4000
server = SCGIServer(app, 4000)
server.run()
		

recent changes #

contact #

You can mail to helmut@subdivi.de, but do not mail devnull@subdivi.de. Otherwise bug me (helmut) on Freenode or OFTC.

Created with Vim

Valid XHTML 1.0!

Valid CSS!

Viewable With Any Browser