My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/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...'
WSGIServer(('', 8088), application).serve_forever()

Change log

e0652944de66 by Denis Bilenko <denis.bilenko> on Jan 31, 2012   Diff
examples/wsgiserver.py: remove empty line
Go to: 
Sign in to write a code review

Older revisions

ea061b1ec796 by Denis Bilenko <denis.bilenko> on Aug 29, 2011   Diff
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)
af4c24f1e711 by Denis Bilenko <denis.bilenko> on May 22, 2011   Diff
examples/wsgiserver.py: use pywsgi
23469225e581 by Denis Bilenko <denis.bilenko> on Sep 14, 2010   Diff
examples: follow pep8
All revisions of this file

File info

Size: 494 bytes, 17 lines
Powered by Google Project Hosting