简体   繁体   English

Django - settings.DATABASES 配置不正确。 请提供 ENGINE 值

[英]Django - settings.DATABASES is improperly configured. Please supply the ENGINE value

I've got a postgres DB which Django successfully connects to but when trying to create a new model I'm getting the error settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.我有一个 Django 成功连接到的 postgres 数据库,但是在尝试创建新的 model 时出现错误settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details. settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

I know settings.DATABASES is correctly configured as I've already created models which then Django used to create tables in the DB but for whatever reason it is now causing this error.我知道 settings.DATABASES 已正确配置,因为我已经创建了模型,然后 Django 用于在数据库中创建表,但无论出于何种原因,它现在都会导致此错误。 You can also see that I have already "supplied the ENGINE value".您还可以看到我已经“提供了 ENGINE 值”。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.environ['POSTGRES_DB'],
        'USER': os.environ['POSTGRES_USER'],
        'PASSWORD': os.environ['POSTGRES_PASSWORD'],
        'HOST': 'db',
        'POST': '5432',
    }
}

All help is appreciated.感谢所有帮助。

Replace your ENGINE setting by:将您的ENGINE设置替换为:

'ENGINE': 'django.db.backends.postgresql'

It is the correct setting in Django 3 and up.这是 Django 3 及更高版本中的正确设置。 See https://docs.djangoproject.com/en/3.0/internals/deprecation/#deprecation-removed-in-3-0 .请参阅https://docs.djangoproject.com/en/3.0/internals/deprecation/#deprecation-removed-in-3-0

Turns out I'm an idiot.原来我是个白痴。

I'm using docker and I forgot that I need to enter the container to do DB migrations ♂️我正在使用 docker 忘记了我需要进入容器进行数据库迁移♂️

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装Graphite时出现Django错误 - settings.DATABASES配置不正确。 请提供ENGINE值 - Django error when installing Graphite - settings.DATABASES is improperly configured. Please supply the ENGINE value 带有Django 1.8的Mongoengine:配置不正确:settings.DATABASES配置不正确。 请提供引擎值 - Mongoengine with Django 1.8: ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value django.core.exceptions.ImproperlyConfigured:settings.DATABASES配置不正确。 请提供引擎值 - django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value settings.DATABASES 配置不正确。 请提供 NAME 值 - settings.DATABASES is improperly configured. Please supply the NAME value settings.DATABASES配置不正确。 安装Nadine时,请在postgres中提供ENGINE值 - settings.DATABASES is improperly configured. Please supply the ENGINE value in postgres while installing Nadine 配置不当:settings.DATABASES 配置不正确。 请提供 ENGINE 值 - ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value 受够了错误ImproperlyConfigured:settings.DATABASES配置不正确。 请提供引擎值 - Fed up with the error ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value 在Heroku上使用Postgresql的Django - settings.DATABASES配置不正确。 请提供NAME值 - Django with Postgresql on Heroku - settings.DATABASES is improperly configured. Please supply the NAME value raise ImproperlyConfigured(“settings.DATABASES 配置不正确。” django.core.exceptions.ImproperlyConfigured: settings.DATABASES - raise ImproperlyConfigured(“settings.DATABASES is improperly configured. ” django.core.exceptions.ImproperlyConfigured: settings.DATABASES 尝试设置Django时,配置不正确(“settings.DATABASES配置不正确。”)错误 - ImproperlyConfigured(“settings.DATABASES is improperly configured. ”) error when trying to set up Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM