Fizzy63
Fizzy63

Reputation: 21

AWS Elastic Beanstalk Deployment Error: 502 Bad Gateway - Django Application

I am having problems deploying my 1st python django app to AWS Elastic Beanstalk. The app appears to upload correctly but when I try to use it I get 502 Bad Gateway.

The logs show the following: *2021/03/25 20:14:53 [error] 5144#0: 357 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.8.43, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "crap-env.eba-2nhwp4ty.us-west-2.elasticbeanstalk.com"

Would appreciate any help.

Upvotes: 2

Views: 2735

Answers (1)

Cullen D
Cullen D

Reputation: 561

Updating based on your comment and the feedback from assembler:

Elastic Beanstalk looks for your config.yml file in the .ebextensions folder

~/ebdjango/
|  .ebextensions   <--make sure to include the (.)
|    config.yml
|  ebdjango
|    __init__.py
|    settings.py
|    urls.py
|    wsgi.py
|  db.sqlite3
|  manage.py
|  requirements.txt

Also make sure to add your CNAME to the ALLOWED_HOSTS variable in settings.py

Upvotes: 1

Related Questions