Commit 405d689c authored by Denis Bilenko's avatar Denis Bilenko

update examples/wsgiserver.py to use wsgi2

parent 92f03301
"""This is a simple example of running a wsgi application with gevent.
For a more fully-featured server which supports multiple processes,
multiple threads, and graceful code reloading, see:
http://pypi.python.org/pypi/Spawning/
#/usr/bin/python
"""Simple wsgi app. Serving on 8088.
"""
from gevent import wsgi, socket
from gevent import wsgi2
def hello_world(env, start_response):
if env['PATH_INFO'] != '/':
start_response('404 Not Found', [('Content-Type', 'text/plain')])
return ['Not Found\r\n']
else:
if env['PATH_INFO'] == '/':
start_response('200 OK', [('Content-Type', 'text/plain')])
return ["Hello World!\r\n"]
else:
start_response('404 Not Found', [('Content-Type', 'text/plain')])
return ['Not Found\r\n']
wsgi.server(socket.tcp_listener(('', 8080)), hello_world)
print __doc__
wsgi2.WSGIServer(('', 8088), hello_world).serve_forever()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment