Running Flask on Twisted - TypeError: __call__() missing 2 required positional arguments

Running Flask on Twisted - TypeError: __call__() missing 2 required positional arguments

我有一个非常简单的 Flask 应用程序,我正尝试使用 Twisted 来托管它。我将 运行 保留在这个错误中,找不到任何简单的例子来做这个。错误是:

TypeError: __call__() missing 2 required positional arguments: 
'environ' and 'start_response'

我的 Flask 代码是 test01.py

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

然后我通过调用启动应用程序:

PYTHONPATH=. twistd web --class=test01.app

我确定我一定遗漏了一些简单的东西,但似乎无法在任何地方找到一个简单的工作示例

尝试使用 --wsgi 而不是 --class--class 需要资源子类。