当通过gevent的pywsgi服务器运行tornado的wsgi应用程序时,greenlet中的异常将被抑制,并且不会在标准错误/输出中显示。我找了又找,找不到为什么会这样。在
下面是一个小测试应用程序来演示:
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import gevent.wsgi
import tornado.web
import tornado.wsgi
class MainHandler(tornado.web.RequestHandler):
def prepare(self):
# this next line will cause a NameError
a = i_dont_exist_here
class App(tornado.wsgi.WSGIApplication):
def __init__(self):
tornado.wsgi.WSGIApplication.__init__(self, [(r"/", MainHandler)])
if __name__ == '__main__':
gevent.wsgi.WSGIServer(('', 80), App()).serve_forever()
你试过运行
tornado.options.parse_command_line()
吗?在输出:
^{pr2}$相关问题 更多 >
编程相关推荐