【问题标题】:django.db.utils.OperationalError: FATAL: database "Path" doesn't existdjango.db.utils.OperationalError:致命:数据库“路径”不存在
【发布时间】:2015-07-28 23:26:31
【问题描述】:

我是 python 和 django 的新手,

我正在尝试在 windows7 中设置 Django,

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.path.join(BASE_DIR, 'amour'),
        'USER': 'openpg',
        'PASSWORD': 'openpgpwd',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

尝试执行服务器时:python manage.py runserver

出现以下错误:django.db.utils.OperationalError: FATAL: database "Path" doesn't exist

我已经安装了 PostgreSql 9.3 和 Python 2.7。

【问题讨论】:

    标签: django postgresql python-2.7


    【解决方案1】:

    您应该传递数据库的名称,而不是文件名。所以如果你 created database 命名为 "amour" 那么设置将是:

    DATABASES = {
        'default': {
            ...
            'NAME': 'amour',
            ...
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-16
      • 1970-01-01
      • 2012-06-07
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      相关资源
      最近更新 更多