更新时间:2023-02-24 09:30:08
您需要安装psycopg2
Python 库.
You need to install psycopg2
Python library.
下载http://initd.org/psycopg/,然后安装在Python PATH下
Download http://initd.org/psycopg/, then install it under Python PATH
下载后,轻松解压压缩包:
After downloading, easily extract the tarball and:
$ python setup.py install
或者,如果您愿意,也可以通过 easy_install 或 pip.
Or if you wish, install it by either easy_install or pip.
(我更喜欢使用 pip 而不是 easy_install.)
$ easy_install psycopg2
$ pip install psycopg2
在设置.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db_name',
'USER': 'db_user',
'PASSWORD': 'db_user_password',
'HOST': '',
'PORT': 'db_port_number',
}
}