502 Bad Gateway Elastic Beanstalk, No Module named "ebdjango"
I'm trying to deploy a django application using elastic beanstalk, I've followed all the steps from the AWS documentation and I get a 502 bad gateway error.
I looked through the elastic beanstalk logs like similar questions suggested and the same error keeps appearing that I didn't see in any other posts.
Jan 6 20:42:24 ip-172-31-32-9 web: ModuleNotFoundError: No module named 'ebdjango'
I can only find similar questions about django module not ebdjango, and pip install obviously doesn't work. I've included other file info that might be relevant. If anything else is needed I'm happy to provide it.
django.config file
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: ebdjango.wsgi:application
aws:autoscaling:launchconfiguration:
DisableIMDSv1: true'
config.yml
branch-defaults:
default:
environment: django-env-2
group_suffix: null
environment-defaults:
django-env:
branch: null
repository: null
global:
application_name: django-env-2
branch: null
default_ec2_keyname: null
default_platform: Python 3.8
default_region: eu-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
EB Error Logs
Jan 6 20:42:25 ip-172-31-32-9 web: Traceback (most recent call last):
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
Jan 6 20:42:25 ip-172-31-32-9 web: worker.init_process()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/workers/gthread.py", line 94, in init_process
Jan 6 20:42:25 ip-172-31-32-9 web: super().init_process()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/workers/base.py", line 135, in init_process
Jan 6 20:42:25 ip-172-31-32-9 web: self.load_wsgi()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi
Jan 6 20:42:25 ip-172-31-32-9 web: self.wsgi = self.app.wsgi()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/app/base.py", line 66, in wsgi
Jan 6 20:42:25 ip-172-31-32-9 web: self.callable = self.load()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
Jan 6 20:42:25 ip-172-31-32-9 web: return self.load_wsgiapp()
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
Jan 6 20:42:25 ip-172-31-32-9 web: return util.import_app(self.app_uri)
Jan 6 20:42:25 ip-172-31-32-9 web: File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/gunicorn/util.py", line 370, in import_app
Jan 6 20:42:25 ip-172-31-32-9 web: mod = importlib.import_module(module)
Jan 6 20:42:25 ip-172-31-32-9 web: File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
Jan 6 20:42:25 ip-172-31-32-9 web: return _bootstrap._gcd_import(name[level:], package, level)
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Jan 6 20:42:25 ip-172-31-32-9 web: File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
Jan 6 20:42:25 ip-172-31-32-9 web: ModuleNotFoundError: No module named 'ebdjango'
Jan 6 20:42:25 ip-172-31-32-9 web: [2025-01-06 20:42:25 +0000] [801] [INFO] Worker exiting (pid: 801)
Jan 6 20:42:25 ip-172-31-32-9 web: [2025-01-06 20:42:25 +0000] [795] [ERROR] Worker (pid:801) exited with code 3
Jan 6 20:42:25 ip-172-31-32-9 web: [2025-01-06 20:42:25 +0000] [795] [ERROR] Shutting down: Master
Jan 6 20:42:25 ip-172-31-32-9 web: [2025-01-06 20:42:25 +0000] [795] [ERROR] Reason: Worker failed to boot.
2025/01/06 20:31:47 [error] 32552#32552: *76 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.13.182, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.32.9"
2025/01/06 20:31:48 [error] 32552#32552: *78 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.34.82, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.32.9"
Thanks for any help!