I have been trying to deploy a django application on awsebcli. immmediately i enter the eb open command i get 502 Bad Gateway NGINX error in return on my web browser. Please i need assistance on how to fix this error, for a better view and understanding my codes screenshots are in the upload links as follows.. settings.py .. 502 bad gateway .. .elasticbeanstalk/config.yml .. .ebextensions\django.config .. aswebcli_status .. django_pip_freeze
I look forward to your kind response. Thank you
It's true that Python 3.7+ on Amazon Linux 2 platform needs gunicorn. In my case I only needed to pip install gunicorn and add it in requirements.txt. I did not need to edit the setting.py file. Also my django.config looks like below:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: ebdjango.wsgi:application
Reference: AWS documentation on deploying Django with Beanstalk
For Python 3.7 Amazon Linux 2 platform for ebs firstly install gunicorn then add it to your requirements.txt and edit the django.config file to
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "elernet.settings"
"PYTHONPATH": "/var/app/current:$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: elernet.wsgi:application
NumProcesses: 3
NumThreads: 20
eb deploy
eb open
Check the file web.stdout.log
; it should tell you what the error was. You can access this by downloading the EB logs, or by running eb ssh
and finding it in the /var/log/
directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.