Python Tornado:缺少WSGI模块?
问题内容:
我做了一个,pip install tornado
但是由于缺少WSGI模块而无法运行以下代码?
http://flask.pocoo.org/docs/deploying/wsgi-
standalone/
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myapp import app
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()
问题答案:
如果您的文件名为tornado.py,它将尝试从该文件而不是站点软件包中的目录导入内容。这可能是“没有名为X的模块”
ImportErrors的最常见来源。重命名该文件,它应该可以工作。
将文件重命名为tornado.py
其他名称后,还要删除tornado.pyc
创建的文件。