X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=eventlet%2Fexamples%2Fwsgi.py;fp=eventlet%2Fexamples%2Fwsgi.py;h=05668a41bdc17759b63d301f520764f342d15415;hb=376ff3bfe7071cc0793184a378c4e74508fb0d97;hp=0000000000000000000000000000000000000000;hpb=70992db4bef26426213a8eae488be377cdd655ae;p=packages%2Ftrusty%2Fpython-eventlet.git diff --git a/eventlet/examples/wsgi.py b/eventlet/examples/wsgi.py new file mode 100644 index 0000000..05668a4 --- /dev/null +++ b/eventlet/examples/wsgi.py @@ -0,0 +1,19 @@ +"""This is a simple example of running a wsgi application with eventlet. +For a more fully-featured server which supports multiple processes, +multiple threads, and graceful code reloading, see: + +http://pypi.python.org/pypi/Spawning/ +""" + +import eventlet +from eventlet import wsgi + + +def hello_world(env, start_response): + if env['PATH_INFO'] != '/': + start_response('404 Not Found', [('Content-Type', 'text/plain')]) + return ['Not Found\r\n'] + start_response('200 OK', [('Content-Type', 'text/plain')]) + return ['Hello, World!\r\n'] + +wsgi.server(eventlet.listen(('', 8090)), hello_world)