[Solved]-AWS Elastic Beanstalk: WSGI path incorrect?

8πŸ‘

I had the same issue. It is because of the Amazon Linux 2 machine image. Its configuration files are incompatible with those of the old version. Please see: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.migration-al.html. I ended up using the old version because the documentation says:

If you’re using an Amazon Linux 2 platform version that is in beta for
your evaluation, do not go to production. Wait until we release a
supported platform version.

You can create an Elastic Beanstalk environment using the Amazon Linux machine image (old version) using the command line tool. Here are the commands (replace <...> with your data):

eb init -p python-3.6 <ApplicationName> --region <Region>
eb create <EnvironmentName> --elb-type application --platform "64bit Amazon Linux 2018.03 v2.9.10 running Python 3.6"

Update 2020-06-02
As I mentioned before, the issue is caused by Amazon Linux 2 platform because it uses Gunicorn, which has a WSGI syntax that is different than the previous version. The WSGIPath must be ebdjango.wsgi:application. Please see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-container.html#python-namespaces.

πŸ‘€Casper

4πŸ‘

In your django.config change:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: ebdjango.wsgi

And in your

import os
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "ebdjango.settings"
application = get_wsgi_application()

1πŸ‘

I had the same problem today messing around with the django.config file. It finally worked for me when I changed the WSGI path in the configuration tab to ebdjango.wsgi:application.

πŸ‘€kml

Leave a comment