Converting Python CGI to WSGI scripts

python at python at
Tue Mar 16 18:18:15 CET 2010

I have a few dozen simple Python CGI scripts.

Are there any advantages or disadvantages to rewriting these CGI
scripts as WSGI scripts?

Apologies if my terminology is not correct ... when I say WSGI
scripts I mean standalone scripts like the following simplified
(as an example) template:

import sys
def application(environ, start_response):
    output = 'Welcome to your mod_wsgi website! It
uses:\n\nPython %s' % sys.version
    response_headers = [
        ('Content-Length', str(len(output))),
        ('Content-Type', 'text/plain'),
    start_response('200 OK', response_headers)
    return [output]

When I say script I don't mean classic WSGI application in the
sense of a .serve_forever() loop coordinating a bunch of related
scripts - I mean individual, standalone scripts.

Hope this makes sense :)

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list