| 1 |
"""This is a simple example of running a wsgi application with eventlet. |
| 2 |
For a more fully-featured server which supports multiple processes, |
| 3 |
multiple threads, and graceful code reloading, see: |
| 4 |
|
| 5 |
http://pypi.python.org/pypi/Spawning/ |
| 6 |
""" |
| 7 |
|
| 8 |
import eventlet |
| 9 |
from eventlet import wsgi |
| 10 |
|
| 11 |
|
| 12 |
def hello_world(env, start_response): |
| 13 |
if env['PATH_INFO'] != '/': |
| 14 |
start_response('404 Not Found', [('Content-Type', 'text/plain')]) |
| 15 |
return ['Not Found\r\n'] |
| 16 |
start_response('200 OK', [('Content-Type', 'text/plain')]) |
| 17 |
return ['Hello, World!\r\n'] |
| 18 |
|
| 19 |
wsgi.server(eventlet.listen(('', 8090)), hello_world) |