在AWSEB命令行上部署Django应用程序时如何解决502 Bad Gateway NGINX错误?

时间:2020-07-10 13:00:33

标签: python django amazon-elastic-beanstalk bad-gateway

我一直试图在awsebcli上部署django应用程序。我立即输入eb open命令,在Web浏览器中返回502 Bad Gateway NGINX错误。请获取有关如何解决此错误的帮助,以便更好地查看和理解我的代码屏幕截图,如下所示。.settings.py .. 502 bad gateway .. .elasticbeanstalk/config.yml .. .ebextensions\django.config .. aswebcli_status .. django_pip_freeze

我期待您的友好答复。谢谢

2 个答案:

答案 0 :(得分:0)

对于 ebs 的 Python 3.7 Amazon Linux 2 平台,首先安装 gunicorn 然后将其添加到您的 requirements.txt 并编辑 django.config 文件以

putIfAbsent()

eb 部署
电子打开

答案 1 :(得分:0)

Amazon Linux 2 平台上的 Python 3.7+ 确实需要 gunicorn。就我而言,我只需要 pip install gunicorn 并将其添加到 requirements.txt 中。我不需要编辑 setting.py 文件。另外我的 django.config 如下所示:

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

参考:AWS documentation on deploying Django with Beanstalk