简体   繁体   English

在 AWSEB 命令行上部署 django 应用程序时,如何修复 502 Bad Gateway NGINX 错误?

[英]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.

相关问题 如何修复生产中的 502 Bad Gateway Error(Nginx)? - How to fix 502 Bad Gateway Error in production(Nginx)? Nginx 错误:502 Bad Gateway nginx/1.23.2 on Docker + Django + Postgres - Nginx error: 502 Bad Gateway nginx/1.23.2 on Docker + Django + Postgres Nginx / Flask / Python应用程序,Nginx抛出502 Bad Gateway错误 - Nginx/Flask/Python App, Nginx throwing 502 Bad Gateway Error 部署 Flask 应用程序时,AWS ElasticBeanstalk 中出现 502 Bad Gateway 错误 - 502 Bad Gateway Error in AWS ElasticBeanstalk while deploying Flask Application 502错误的网关错误与运行uwsgi和nginx的python应用程序(centos) - 502 Bad Gateway error with python app running uwsgi and nginx (centos) 收到502 Bad Gateway错误并通过django,nginx,gunicorn发送电子邮件 - Getting 502 Bad Gateway error and sending a email with django, nginx, gunicorn 错误:nginx和uwsgi上的烧瓶应用程序中的502错误网关 - error: 502 bad gateway in flask app on nginx and uwsgi 在 GCP 中浏览 Flask 应用时出现“502 Bad Gateway nginx”错误 - '502 Bad Gateway nginx' error for browsing Flask app in GCP Django上的502 Bad Gateway nginx / 1.1.19 - 502 Bad Gateway nginx/1.1.19 on django django-gunicorn-nginx:502坏网关 - django-gunicorn-nginx: 502 bad gateway
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM