My Python web application is called app
# example.py
import flask
app = flask.Flask(__name__.split('.')[0])
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()
I get
mod_wsgi (pid=22473): Target WSGI script '/opt/python/current/app/run.py' does not contain WSGI application 'application'.
How to I tell AWS that my application instance is called app
?
mod_wsgi expects variable called application
. Try to do something like this
from example import app as application
Note: don't do application.run()
. It is not needed.
来源:https://stackoverflow.com/questions/28048342/how-do-i-configure-the-name-of-my-wsgi-application-on-aws-elastic-beanstalk