Reputation: 1
I have been trawling the internet looking for a solution to this problem and have come up empty handed after trying multiple different things. Im looking to get the vanilla django project deployed on AWS EB. I am new to this so I am sure there is something simple that I am missing. I followed this tutorial: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html as well as many other YouTube / Stack tutorials and posts hoping to get around this 502 error.
Here is my setup. project setup
This is my django.config file:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: ebdjango.wsgi:application
Here is my config.yml file:
branch-defaults:
default:
environment: django-env2
group_suffix: null
global:
application_name: django-tut
branch: null
default_ec2_keyname: null
default_platform: Python 3.9
default_region: us-west-2
include_git_submodules: true
instance_profile: null
platform_name: null
platform_version: null
profile: eb-cli
repository: null
sc: null
workspace_type: Application
In Settings.py the only change I made was:
ALLOWED_HOSTS = ['django-env2.eba-wftrfqr2.us-west-2.elasticbeanstalk.com']
This is requirements.txt
asgiref==3.7.2
Django==3.1.3
pytz==2023.3.post1
sqlparse==0.4.4
typing_extensions==4.8.0
When I run the server locally it works perfectly, giving the generic django page on http://127.0.0.1:8000/ (this is before I update ALLOWED_HOSTS of course).
In console its status turns to "Severe" and a warning event is displayed: "Environment health has transitioned from Pending to Severe. ELB processes are not healthy on all instances. None of the instances are sending data. 50.0 % of the requests to the ELB are failing with HTTP 5xx. Insufficient request rate (2.0 requests/min) to determine application health (4 minutes ago). ELB health is failing or not available for all instances."
I cant really see any more than this. When I hop over the logs tab then there is nothing there. Any help would be appreciated; I feel like I've been hitting my head against a brick wall for days now. Thanks
Upvotes: 0
Views: 286
Reputation: 1
You have to add DJANGO_SETTINGS_MODULE in any config inside .ebextensions
Example:
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: ebdjango.settings
Upvotes: 0