Flask 应用程序未重新启动 twisted 16.4.X 作为 wsgi

Flask app is not start over twisted 16.4.X as wsgi

我有简单的 Flask 应用程序 test.py:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def test():
    return 'Hello world!'

if __name__ == '__main__':
    app.run()

运行 扭曲 16.3.0 工作正常:

twistd -n web --port 5000 --wsgi test.app

升级到 16.4.0 后,我在启动时遇到错误:

No such WSGI application: 'test.app'

什么意思?

您可能会选择 test 模块,它是 Python 标准库的一部分。将您的代码文件(模块)重命名为其他名称。您可能还需要设置 PYTHONPATH 以便它在代码模块所在的目录中查找。