我应该在Django的DATABASE_ENGINE中使用哪些Postgres值? [英] Which Postgres value should I use in Django's DATABASE_ENGINE?
问题描述
这是我第一次使用PostgreSQL 8.4.2与Django(过去我一直使用MySQL或sqlite3)。应该在 settings.py
, postgresql_psycopg2 $ c $中的
DATABASE_ENGINE
中使用哪个值c>或 postgresql
?
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?
推荐答案
Django 1.9的更新
django.db.backends.postgresql_psycopg2
后端已被重命名为 django.db.backends.postgresql
code>在Django 1.9。 ( psycopg2
名称仍然可以用于向后兼容性。)
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.)
本质上,对于Django≥1.9 ,请使用 django.db.backends.postgresql
。
请注意Django的文档中的 ENGINE
设置。
See note in Django's documentation for the ENGINE
setting.
postgresql_psycopg2
和 postgresql
都使用 psycopg ,版本2和1。它们都被实现为使用libpq API到PostgreSQL的C扩展。
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
目前推荐 - 原作者已弃用第1版,只能新版本的版本2 。
当Django最初发布时,psycopg2仍然处于测试状态,不推荐使用,但是从已更改。
When Django was originally released, psycopg2 was still in beta and was not recommended, but this has long since changed.
这篇关于我应该在Django的DATABASE_ENGINE中使用哪些Postgres值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!