【发布时间】:2019-11-27 16:02:02
【问题描述】:
我一丝不苟地按照官方 AWS 指南将 Django 应用程序部署到 Elastic Beanstalk (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html) 用于学校项目。它在本地工作,但是当我尝试部署它时显示 500 错误消息。我对我的代码进行了许多调整,但它们似乎并不有效。 AWS 控制面板显示一条警告,内容为:环境运行状况已从 OK 转变为 Warning。 100% 的请求以 HTTP 5xx 失败。我目前在欧洲,这可能是时区问题吗?
我尝试将调试模式从 true 更改为 false,但我认为这不是问题所在。我真的不明白为什么它不起作用,我在终端的执行中从来没有遇到过错误,它总是正确地部署了所有东西。由于某种原因,它只是不显示网页。
MacBook-Air-di-Davide:ebdjango davidemerlin$ eb create django-env
Creating application version archive "app-190718_165248".
Uploading ebdjango/app-190718_165248.zip to S3. This may take a while.
Upload Complete.
Environment details for: django-env
Application name: ebdjango
Region: eu-central-1
Deployed Version: app-190718_165248
Environment ID: e-3mxbcch2rm
Platform: arn:aws:elasticbeanstalk:eu-central-1::platform/Python 3.6 running on 64bit Amazon Linux/2.8.6
Tier: WebServer-Standard-1.0
CNAME: UNKNOWN
Updated: 2019-07-18 14:52:51.893000+00:00
Printing Status:
2019-07-18 14:52:51 INFO createEnvironment is starting.
2019-07-18 14:52:52 INFO Using elasticbeanstalk-eu-central-1-725098113628 as Amazon S3 storage bucket for environment data.
2019-07-18 14:53:16 INFO Created security group named: sg-0d5da9ecf4206ab11
2019-07-18 14:53:32 INFO Created load balancer named: awseb-e-3-AWSEBLoa-GCK3W368WNAW
2019-07-18 14:53:32 INFO Created security group named: awseb-e-3mxbcch2rm-stack-AWSEBSecurityGroup-10HEII5KA2YFV
2019-07-18 14:53:32 INFO Created Auto Scaling launch configuration named: awseb-e-3mxbcch2rm-stack-AWSEBAutoScalingLaunchConfiguration-16YCNNVJS4QJG
-- Events -- (safe to Ctrl+C)
eb status
Environment details for: django-env
Application name: ebdjango
Region: eu-central-1
Deployed Version: None
Environment ID: e-3mxbcch2rm
Platform: arn:aws:elasticbeanstalk:eu-central-1::platform/Python 3.6 running on 64bit Amazon Linux/2.8.6
Tier: WebServer-Standard-1.0
CNAME: django-env.q7fdcfwnii.eu-central-1.elasticbeanstalk.com
Updated: 2019-07-18 14:53:32.535000+00:00
Status: Launching
Health: Grey
Alert: An update to the EB CLI is available. Run "pip install --upgrade awsebcli" to get the latest version.
(base) MacBook-Air-di-Davide:ebdjango davidemerlin$ eb deploy
Creating application version archive "app-190718_165726".
Uploading ebdjango/app-190718_165726.zip to S3. This may take a while.
Upload Complete.
2019-07-18 14:57:28 INFO Environment update is starting.
2019-07-18 14:57:31 INFO Deploying new version to instance(s).
2019-07-18 14:57:53 INFO New application version was deployed to running EC2 instances.
2019-07-18 14:57:53 INFO Environment update completed successfully.
Alert: An update to the EB CLI is available. Run "pip install --upgrade awsebcli" to get the latest version.
(base) MacBook-Air-di-Davide:ebdjango davidemerlin$ eb open'''
I expect to load the page at django-env.q7fdcfwnii.eu-central-1.elasticbeanstalk.com
【问题讨论】:
-
日志 (
eb logs) 和运行状况 (eb health) 是什么样的?你可以通过 ssh 进入你的实例吗? -
正如@danimal 指出的,检查
eb logs。考虑到正在返回 HTTP 500,您应该会在输出中看到堆栈跟踪。
标签: python django bash amazon-web-services amazon-elastic-beanstalk