【问题标题】:ElasticBeanstalk Django: Please supply ENGINE valueElasticBeanstalk Django:请提供 ENGINE 值
【发布时间】:2017-10-20 18:22:50
【问题描述】:

我正在尝试使用 ElasticBeanstalk 安装 Django 应用程序。除了settings.DATABASES is improperly configured. Please supply the ENGINE value

,它失败了

完全错误:

Command failed on instance. Return code: 1 Output: (TRUNCATED)... in 
complain raise ImproperlyConfigured("settings.DATABASES is improperly
configured. " django.core.exceptions.ImproperlyConfigured: 
settings.DATABASES is improperly configured. Please supply the ENGINE value.
Check settings documentation for more details. 
container_command 01_migrate in .ebextensions/15_my.config failed. For more 
detail, check /var/log/eb-activity.log using console or EB CLI.`

我在执行我的一个命令时收到此错误:

01_migrate:
command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput"
leader_only: True

这是我的 config/settings/production.py

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'ebdb',
    'USER': 'djangousername',
    'PASSWORD': 'djangopassword',
    'HOST': env('RDS_HOSTNAME'),
    'PORT': '5432'
}
}

我有点确定 EB 仅从该文件中选择配置,而不是从任何其他文件中选择配置,因为如果我更改此文件中的某些内容,它会在 ElasticBeanstalk 环境创建时反映出来。我还在整个应用程序中搜索了 DATABASES 仅在此文件中提及,即 <app-rot>/config/settings/production.py<app-root>/config/settings/local.py。在这两个地方,我都提供了上面的ENGINE 值。

如果我需要添加任何其他相关信息,请告诉我

【问题讨论】:

  • 但是你如何告诉 Django 查看设置/生产?

标签: python django postgresql amazon-elastic-beanstalk


【解决方案1】:

这让我花了很长时间才弄明白(与 Django 和 EB 的大多数事情一样)。我认为您在控制台中设置的环境变量优先于您在其他任何地方设置的变量或设置,例如.ebextensions。

在我的情况下,错误是因为我的设置文件在我的 ebextensions 中设置正确,但在控制台变量中设置不正确。感谢@daniel 的提示

【讨论】:

    猜你喜欢
    • 2012-07-12
    • 2012-08-03
    • 2013-01-08
    • 2013-11-28
    • 2017-04-21
    • 1970-01-01
    • 2018-10-11
    • 2012-04-08
    • 2014-11-22
    相关资源
    最近更新 更多