def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return '<h1>Hello, web!</h1>'
# 1st
# Just for Test and it is single thread
from wsgiref.simple_server import make_server
httpd = make_server('', 8000, application)
httpd.serve_forever()
# 2nd
# Use paste httpserver
from paste import httpserver
httpserver.serve(application, host='127.0.0.1', port=8000)
# 3rd
# Use eventlet
import eventlet
from eventlet import wsgi
wsgi.server(eventlet.listen(('', 8000)), application)
print "Serving HTTP on port 8000..."