Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure the name of my WSGI application on AWS Elastic Beanstalk?

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?

like image 443
orome Avatar asked Jan 20 '15 14:01

orome


People also ask

How do I change my Elastic Beanstalk application name?

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.

What is WSGI path?

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.

What is a WSGI application?

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.


1 Answers

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.

like image 196
Dmitry Nedbaylo Avatar answered Sep 28 '22 02:09

Dmitry Nedbaylo