django - Django 数据库问题
问题描述
您好,我的 Django 数据库出现问题。
这是我的 settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'MConDb',
'USER': 'postgres',
'PASSWORD': 'KODOkona880,',
'HOST': 'localhost',
'PORT': 5432,
}
}
这是我得到的错误。
conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: FATAL: database "MConDb" does not exist
这是 postgres 中的命令 \l 显示的列表
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------------+----------+----------+----------------------------+---
django | postgres | UTF8 | English_United States.1252 | English_United States.1252 |
mcondb | postgres | UTF8 | English_United States.1252 | English_United States.1252 |
postgres | postgres | UTF8 | English_United States.1252 | English_United States.1252 |
希望你能帮助我,我将非常感激谢谢。
解决方案
您的数据库名称全是小写字母mcondb | postgr..
,那您为什么要使用'NAME': 'MConDb'
试试这个 :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mcondb',
'USER': 'postgres',
'PASSWORD': 'KODOkona880,',
'HOST': 'localhost',
'PORT': 5432,
}
}
您确定您的密码包含,
结尾吗?请确认。
推荐阅读
- c++ - 让静态成员函数在c ++中调用非静态成员std :: function的正确方法是什么?
- c++ - 错误:文件无法识别:文件格式无法识别c ++
- node.js - 两个 docker 服务之间的 HTTP 请求工作正常,但我不知道为什么
- php - 在 Laravel 中,即使在将 $redirectTo 变量更改为 '/ 之后,注册应用程序也会重定向到 '/home'
- nestjs - NestJs | 设置最大标题大小
- python - Python:从数据趋势中找出异常值
- flutter - 使用 Future 时无法将值存储到颤振/飞镖中的类变量
- c# - C# 在 Enumerable.All 扩展中使用带有 return bool 的异步 lambda 表达式
- docker - 如何在 dockerized 环境中使用 webdriverio 测试节点应用程序 (ERR_SSL_PROTOCOL_ERROR)
- scala - 在 scala 数据框中操作数据表连接