Which Postgres value should I use in Django's DATABASE_ENGINE?

一曲冷凌霜 提交于 2019-12-10 12:28:21

问题


It's my first time using PostgreSQL 8.4.2 with Django(I have always used MySQL or sqlite3 in the past). Which value should I use for DATABASE_ENGINE in settings.py, postgresql_psycopg2 or postgresql? How do they differ from each other?


回答1:


Update for Django 1.9

The django.db.backends.postgresql_psycopg2 backend has been renamed to django.db.backends.postgresql in Django 1.9. (The psycopg2 name can still be used for backwards compatibility.)

Essentially, for Django ≥1.9, use django.db.backends.postgresql.

See note in Django's documentation for the ENGINE setting.

History (Django ≤ 1.8)

postgresql_psycopg2 and postgresql both use psycopg, versions 2 and 1 respectively. They are both implemented as C extensions using the libpq API to PostgreSQL.

postgresql_psycopg2 is currently recommended -- the original author has deprecated version 1 and is only making new releases of version 2.

When Django was originally released, psycopg2 was still in beta and was not recommended, but this has long since changed.



来源:https://stackoverflow.com/questions/2099219/which-postgres-value-should-i-use-in-djangos-database-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!