【问题标题】:Unable to resolve following error using Django tutorial - ImproperlyConfigured: settings.DATABASES is improperly configured无法使用 Django 教程解决以下错误 - 配置不当:settings.DATABASES 配置不正确
【发布时间】:2013-08-16 06:06:51
【问题描述】:

我正在使用django tutorial 来学习如何使用 Django。

我无法解决此错误

ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

我输入后出现此错误

python manage.py syncdb

在 CentOS 上使用的 django 版本是 1.5

【问题讨论】:

  • 你能粘贴你的settings.py吗?
  • 那么,您是否提供了 ENGINE 值?

标签: django syncdb


【解决方案1】:

您需要在settings.pyDATABASES 设置中指定ENGINE 值。可用的选项是

  • django.db.backends.postgresql_psycopg2
  • django.db.backends.mysql
  • django.db.backends.sqlite3
  • django.db.backends.oracle

您还可以指定自定义后端。更多信息请参考django docs

【讨论】:

    【解决方案2】:

    如果使用 postgresql 或 sqlite 或 mysql 后端,您可能忘记指定引擎名称。

    it's up to what kind of database you are using.
    for example for postgresql:
    
    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        # Add 'postgresql_psycopg2',      
         }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-22
      • 2018-01-06
      • 2020-12-10
      相关资源
      最近更新 更多