view makeitso/python_package/{{package}}/web.py @ 206:d9d7bfdb54db

http://stackoverflow.com/questions/4375327/python-argparse-preformatted-help-text
author Jeff Hammel <k0scist@gmail.com>
date Fri, 21 Nov 2014 14:36:17 -0800
parents 5964dabba04a
children 745c785b6986
line wrap: on
line source

#!/usr/bin/env python

"""
web handler for {{project}}
"""

from webob import Request, Response, exc

class Handler(object):

    def __init__(self, **kw):
        pass

    def __call__(self, environ, start_response):
        request = Request(environ)
        response = Response(content_type='text/plain',
                            body="{{project}}")
        return response(environ, start_response)

if __name__ == '__main__':
    from wsgiref import simple_server
    app = Handler()
    server = simple_server.make_server(host='0.0.0.0', port=8080, app=app)
    server.serve_forever()