不像 Azure Flask Deployment - WSGI Interface问题,将 Flask 应用部署到 Azure Web 角色会引发以下问题。
AttributeError: 'module' object has no attribute 'wsgi_app'
这个错误是什么?
最佳答案
我终于明白了。
启动 .py
文件必须在 Flask 应用定义之后定义 wsgi_app
。
app = Flask(__name__)
# define for IIS module registration.
wsgi_app = app.wsgi_app
if __name__ == '__main__':
app.run()
此外,{StartupModule}.wsgi_app
是在 Project Properties > Web > WSGI Handler
中定义的。
为了缩短试错时间,最好从新创建的 Azure WebRole Python 项目模板开始。
哇哦。花了一整天的时间。
关于Azure WebRole + Flask : AttributeError: 'module' object has no attribute 'wsgi_app' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39427398/