How to deploy structured Flask app on AWS elastic beanstalk

Question:

After successfully deploying a test app using the steps outlined here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_flask.html

I tried to deploy my actual flask application which has the following structure:

Where views.py contains my url mappings.

I have tried initializing the eb instance in the root directory as well as within the myApp module and git aws.push but I get the following error on the AWS dashboard:
ERROR Your WSGIPath refers to a file that does not exist. and the application does not work (404 for any path).

How can I deploy the above Flask application to elastic beanstalk?

Answer:

Add the following to .ebextensions/<env-name>.config:

Update:

If you don’t have .ebextensions directory, please create one for the project. You can find more information of what can be done regarding the container configuration in Customizing and Configuring AWS Elastic Beanstalk Environments guide.

Leave a Reply