如何在AWS弹性Beanstalk上配置WSGI应用程序的名称?

时间:2022-01-10 20:10:30

My Python web application is called app

我的Python web应用程序叫做app

# example.py
import flask

app = flask.Flask(__name__.split('.')[0])

and when I attempt to launch it on AWS-EB using

当我尝试用AWS-EB发射时

# run.py (set correctly with WSGIPath)
from example import app

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

I get

我得到

mod_wsgi (pid=22473): Target WSGI script '/opt/python/current/app/run.py' does not contain WSGI application 'application'.

mod_wsgi (pid=22473):目标是WSGI脚本'/opt/python/current/app/run。py'不包含WSGI应用程序'application'。

How to I tell AWS that my application instance is called app?

如何告诉AWS我的应用实例是app?

1 个解决方案

#1


12  

mod_wsgi expects variable called application. Try to do something like this

mod_wsgi期望被称为application的变量。试着做这样的事情

from example import app as application

Note: don't do application.run(). It is not needed.

注意:不要做application.run()。它不需要。

#1


12  

mod_wsgi expects variable called application. Try to do something like this

mod_wsgi期望被称为application的变量。试着做这样的事情

from example import app as application

Note: don't do application.run(). It is not needed.

注意:不要做application.run()。它不需要。