Converting Python CGI to WSGI scripts

python at bdurham.com python at bdurham.com
Tue Mar 16 13:18:15 EDT 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,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100316/5129f490/attachment.html>


More information about the Python-list mailing list