【发布时间】:2020-09-21 16:19:39
【问题描述】:
我通过 Beanstalk 设置了一个 EC2 实例,但我无法让配置运行迁移
我的.ebextension/django.config
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: my_app.settings
aws:elasticbeanstalk:container:python:
WSGIPath: my_app.wsgi:application
NumProcesses: 3
NumThreads: 20
container_commands:
00_test_output:
command: "echo 'testing.....'"
01_migrate:
command: "python manage.py migrate"
leader_only: true
检查日志后,它说
Invalid HTTP_HOST header: '52.37.179.147'. You may need to add '52.37.179.147' to ALLOWED_HOSTS.
Invalid HTTP_HOST header: '172.31.0.249'. You may need to add '172.31.0.249' to ALLOWED_HOSTS.
现在,即使我将这些 ip 添加到我的 settings.py 中的 ALLOWED_HOSTS,问题仍然存在。我在这里搜索并没有找到这个特定问题的答案
没有迁移命令,我的服务器构建成功并且正在运行。
有人知道为什么吗?
编辑:
添加更多信息:
当我在提交到我的 github 后运行 eb deploy 时,出现以下错误
2020-06-03 03:45:10 ERROR [Instance: i-05f872f7e96ccd26d] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-06-03 03:45:11 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-06-03 03:45:11 ERROR Unsuccessful command execution on instance id(s) 'i-05f872f7e96ccd26d'. Aborting the operation.
2020-06-03 03:45:11 ERROR Failed to deploy application.
然后我进入web.stdout.log 查找那些 allowed_host 错误。再说一次,从另一篇文章来看,似乎没有添加这些 ip 的帮助,因为它们是 AWS ip 的
我无法从 cloudwatch 中找到其他错误日志。这似乎是唯一的嫌疑人
eb-engine.log 只说
Error occurred during build: Command 01_migrate failed
所以我知道echo 工作了.....
【问题讨论】:
-
您使用什么数据库引擎?是mysql5.7吗?
-
Postgres。我在requirement.txt中安装了psycopg2
标签: django amazon-web-services amazon-elastic-beanstalk