如何配置我的AWS弹性魔豆WSGI应用程序的名称?
问题描述:
我的Python Web应用程序被称为应用
My Python web application is called app
# example.py
import flask
app = flask.Flask(__name__.split('.')[0])
当我尝试使用启动它的AWS-EB
and when I attempt to launch it on AWS-EB using
# run.py (set correctly with WSGIPath)
from example import app
if __name__ == "__main__":
app.run()
我收到
的mod_wsgi(PID = 22473):目标WSGI脚本/opt/python/current/app/run.py'不包含WSGI应用程序的应用程序
mod_wsgi (pid=22473): Target WSGI script '/opt/python/current/app/run.py' does not contain WSGI application 'application'.
如何我告诉AWS我的应用程序实例名为应用
?
How to I tell AWS that my application instance is called app
?
答
mod_wsgi的预期变量名为应用程序
。尝试做这样的事情
mod_wsgi expects variable called application
. Try to do something like this
from example import app as application
请注意:不要做 application.run()
。它是不需要的。
Note: don't do application.run()
. It is not needed.