我曾经使用python一段时间,但从来没有django。我正在接手一个不同的员工在离开公司之前做的项目。我想知道选项postgresql和postgresql_psycopg2作为django的数据库驱动程序之间是否存在差异。
在一些文章和关于如何设置django项目的文档中我只看到了postgresql,在others中我看到了postgresql_psycopg2。我在提到psycopg2的文档(here或here)中找不到任何内容,所以这只是编写选项的旧方法吗?
一个只是另一个的别名还是它们实际上是不同的引擎?我也找不到任何其他SO问题。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',# here I also saw postgres_psycopg2
'NAME': 'premqcsite',
'USER': 'django_user',
'PASSWORD': 'Encepta_123',
'HOST': 'localhost',
'PORT': '5432',
}}
一样的。 django.db.backends.postgresql_psycopg2
在django <1.8中使用,并在django 1.9中更名为django.db.backends.postgresql
。来自docs:
在Django 1.9中更改:
在旧版本中,django.db.backends.postgresql后端名为django.db.backends.postgresql_psycopg2。为了向后兼容,旧名称仍适用于较新版本。