Created
February 6, 2013 20:12
-
-
Save schmir/4725393 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""WSGI server example""" | |
from gevent.pywsgi import WSGIServer | |
def application(env, start_response): | |
if env['PATH_INFO'] == '/': | |
start_response('200 OK', [('Content-Type', 'text/html')]) | |
return ["<b>hello world</b>"] | |
else: | |
start_response('404 Not Found', [('Content-Type', 'text/html')]) | |
return ['<h1>Not Found</h1>'] | |
if __name__ == '__main__': | |
print 'Serving on 8088...' | |
s = WSGIServer(('', 8088), application) | |
s.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment