【发布时间】:2019-07-10 20:13:53
【问题描述】:
我在 Django 项目中创建了 PostgreSQL。当我为数据库迁移时,它会返回此异常。
django.core.exceptions.ImproperlyConfigured: 'django.db.backends.postgresql'
isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'sqlite3'
我尝试了postgresql_psycopg2 和pip install psycopg2-binary 但不起作用。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'eatadil',
'USER': 'postgre',
'PASSWORD': 'realpassword',
'HOST': 'localhost',
'PORT': '5432',
}
}
我该如何解决这个问题?
【问题讨论】:
-
您在虚拟环境中工作吗?如果是这样,您是否将 psycopg2-binary 安装到虚拟环境中?
-
是的,我正在使用虚拟环境。我下载了 psycop2-binary 但找不到 postgresql
-
这个问题没有解决。为什么我不能使用 PostgreSQL?
标签: python django postgresql