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
?
Open the Elastic Beanstalk console , and in the Regions list, select your AWS Region. In the navigation pane, choose Applications, and then choose your application's name from the list.
WSGI Path – The name of or path to your main application file. For example, application.py , or django/wsgi.py . NumProcesses – The number of processes to run on each application instance. NumThreads – The number of threads to run in each process.
WSGI stands for "Web Server Gateway Interface". It is used to forward requests from a web server (such as Apache or NGINX) to a backend Python web application or framework.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With