I'm struggling to deploy a flask-app to AWS with Elastic Beanstalk. It deploys fine locally but kicks an error when I try to push to EB.
After reading joshmcode's answer here, I changed my flask application name from the conventional app to application, changed my file name to application.py, and made sure the Elastic Beanstalk config file matched. This didn't solve the problem.
The relevant part of my eb config file:
aws:elasticbeanstalk:container:python:
NumProcesses: '1'
NumThreads: '15'
StaticFiles: /static/=static/
WSGIPath: application.py
My File Structure:
In a folder FlaskAWS, I have the root flask directory ("flask-chatterbot") and the virtual environment, like:
venv
flask-chatterbot
-requirements.txt
-application.py
Templates
-index.html
Static
css
-styles.css
js
-dynam.js
Commands before error:
After successfully deploying locally, I froze the package requirements with
pip freeze > requirements.txt
Then deactivted the virtual environment
deactivate
Initialized the CLI repository with the
eb initcommandeb init -p python example-chatbot
At this point, I choose the version of Python and set up the SSH keys without any problems.
4) After this I ran
eb create flask-environ
I receive the following error:
MacBook-Air:flaskaws patrickharris$ eb create flask-environ
Creating application version archive "app-180409_132356".
Uploading flask-app/app-180409_132356.zip to S3. This may take a while.
Upload Complete.
Environment details for: flask-environ
Application name: flask-app
Region: us-west-1
Deployed Version: app-180409_132356
Environment ID: xxxidxxx
Platform: arn:aws:elasticbeanstalk:us-west-1::platform/Python 2.6 running on 64bit Amazon Linux/2.6.6
Tier: WebServer-Standard-1.0
CNAME: UNKNOWN
Updated: 2018-04-09 20:23:59.312000+00:00
Printing Status:
INFO: createEnvironment is starting.
INFO: Using elasticbeanstalk-us-west-1-814752048877 as Amazon S3 storage bucket for environment data.
INFO: Created security group named: sg-0f84dd5f7959f932f
INFO: Created security group named: awseb-e-7iaptyh9gg-stack-AWSEBSecurityGroup-19AXML05AP8UG
INFO: Created load balancer named: awseb-e-7-AWSEBLoa-5F4QOOSPZA9I
INFO: Created Auto Scaling launch configuration named: awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingLaunchConfiguration-1TSKD50BLQBZ7
INFO: Created Auto Scaling group named: awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J
INFO: Waiting for EC2 instances to launch. This may take a few minutes.
INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-1:814752048877:scalingPolicy:f03d20db-305d-4eff-83bd-fa5532d682ea:autoScalingGroupName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J:policyName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingScaleUpPolicy-154NI4YA5Y480
INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-1:814752048877:scalingPolicy:f70e6de5-c82d-48f0-9324-db3fd69813a9:autoScalingGroupName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J:policyName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingScaleDownPolicy-MG1G34PEZK13
INFO: Created CloudWatch alarm named: awseb-e-7iaptyh9gg-stack-AWSEBCloudwatchAlarmLow-ELWRG701RZXB
INFO: Created CloudWatch alarm named: awseb-e-7iaptyh9gg-stack-AWSEBCloudwatchAlarmHigh-FRMTYE8GUX0W
****ERROR: Your WSGIPath refers to a file that does not exist.****
Any help here would be appreciated.