[英]How can i fix 502 Bad Gateway NGINX error while deploying a django app on AWSEB command line?
I have been trying to deploy a django application on awsebcli.我一直在尝试在 awsebcli 上部署 django 应用程序。 immmediately i enter the eb open command i get 502 Bad Gateway NGINX error in return on my web browser.我立即输入 eb open 命令,在我的 web 浏览器上得到 502 Bad Gateway NGINX 错误。 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请我需要有关如何修复此错误的帮助,以便更好地查看和理解我的代码截图在上传链接中,如下所示.. 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.亚马逊Linux 2平台上的Python 3.7+确实需要gunicorn。 In my case I only needed to pip install gunicorn and add it in requirements.txt.就我而言,我只需要 pip 安装 gunicorn 并将其添加到 requirements.txt 中。 I did not need to edit the setting.py file.我不需要编辑 setting.py 文件。 Also my django.config looks like below:我的 django.config 如下所示:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: ebdjango.wsgi:application
Reference: AWS documentation on deploying Django with Beanstalk参考: 关于使用 Beanstalk 部署 Django 的 AWS 文档
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对于 Python 3.7 Amazon Linux 2 平台的 ebs 首先安装 gunicorn 然后将其添加到您的 requirements.txt 并编辑 django.config 文件
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 部署
eb open eb 打开
Check the file web.stdout.log
;检查文件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.您可以通过下载 EB 日志或运行eb ssh
并在/var/log/
目录中找到它来访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.