"""A web.py application powered by gevent"""
from gevent import monkey; monkey.patch_all()
return 'Hello, world!<br><a href="/long">/long</a>'
# Since gevent.wsgi executes each incoming connection in a separate greenlet
# long running requests such as this one don't block one another;
# becomes greenlet-local storage thus making requests isolated as they should be.
print 'handling GET context id = %s' % (id(web.ctx._getd()), )
- gevent.sleep(10) # possible to block the request indefinitely, without harming others
+ gevent.sleep(10) # possible to block the request indefinitely, without harming others
return 'Hello, 10 seconds later'
if __name__ == "__main__":
application = web.application(urls, globals()).wsgifunc()
print 'Serving on 8088...'
WSGIServer(('', 8088), application).serve_forever()