864 B
864 B
wsgi
-- WSGI server
The wsgi module provides a simple an easy way to start an event-driven WSGI server. This can serve as an embedded web server in an application, or as the basis for a more full-featured web server package. One such package is Spawning.
To launch a wsgi server, simply create a socket and call eventlet.wsgi.server
with
it:
from eventlet import wsgi
import eventlet
def hello_world(env, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello, World!\r\n']
wsgi.server(eventlet.listen(('', 8090)), hello_world)
You can find a slightly more elaborate version of this code in the
file examples/wsgi.py
.
eventlet.wsgi