Commit 99e52aa1 authored by Denis Bilenko's avatar Denis Bilenko

wsgiserver.py: rename 'hello_world' to 'application'; only start server if run...

wsgiserver.py: rename 'hello_world' to 'application'; only start server if run as a script (so that it can also be run by another server)
parent 1e8196fb
......@@ -4,7 +4,7 @@
from gevent.pywsgi import WSGIServer
def hello_world(env, start_response):
def application(env, start_response):
if env['PATH_INFO'] == '/':
start_response('200 OK', [('Content-Type', 'text/html')])
return ["<b>hello world</b>"]
......@@ -12,5 +12,7 @@ def hello_world(env, start_response):
start_response('404 Not Found', [('Content-Type', 'text/html')])
return ['<h1>Not Found</h1>']
print 'Serving on 8088...'
WSGIServer(('', 8088), hello_world).serve_forever()
if __name__ == '__main__':
print 'Serving on 8088...'
WSGIServer(('', 8088), application).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