From 6c7445cce4c8a05c3e762fd1d537c54d6ea1fc8c Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Fri, 22 Jan 2010 21:55:09 +0000 Subject: Branch myrpki code before starting rototill based on feedback from Tokyo workshop. svn path=/myrpki.rototill; revision=2958 --- myrpki.rototill/wsgi-example.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 myrpki.rototill/wsgi-example.py (limited to 'myrpki.rototill/wsgi-example.py') diff --git a/myrpki.rototill/wsgi-example.py b/myrpki.rototill/wsgi-example.py new file mode 100644 index 00000000..5ae8ad13 --- /dev/null +++ b/myrpki.rototill/wsgi-example.py @@ -0,0 +1,27 @@ +# $Id$ + +# Every WSGI application must have an application object - a callable +# object that accepts two arguments. For that purpose, we're going to +# use a function (note that you're not limited to a function, you can +# use a class for example). The first argument passed to the function +# is a dictionary containing CGI-style envrironment variables and the +# second variable is the callable object (see PEP333) + +# See http://pythonpaste.org/do-it-yourself-framework.html for a +# somewhat more complete introduction, although it's a lead-in to the +# Paste package which we might not want to use. + +def hello_world_app(environ, start_response): + status = '200 OK' # HTTP Status + headers = [('Content-type', 'text/plain')] # HTTP Headers + start_response(status, headers) + + # The returned object is going to be printed + return ["Hello World"] + +# Run server with this app on port 8000 if invoked as a script + +if __name__ == "__main__": + from wsgiref.simple_server import make_server + print "Serving on port 8000..." + make_server('', 8000, hello_world_app).serve_forever() -- cgit v1.2.3