ModuleNotFoundError: No module named 'application' when deploying Django app to AWS EB
I'm trying to deploy a django project to Elastic Beanstalk. I have the following code in .ebeextensions/django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: pos.wsgi:application
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: pos.settings
I see this error all the time in the logs ModuleNotFoundError: No module named 'application'
I've tried to write the config file this way, but still the same error
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: pos/wsgi.py
Here is the platform Python 3.8 running on 64bit Amazon Linux 2/3.4.2
Besides having this block in django.config I also had to specify the wsgi path in elastic beanstalk cinfiguration.
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "pos.settings"
PYTHONPATH: "/var/app/current:$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: "pos.wsgi:application"