我尝试了许多可用的选项,但对我来说却无济于事。
这是我的环境
这是我用来建立连接的方法
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'xxxx',
'USER': 'postgres',
'PASSWORD': 'admin',
'HOST': 'localhost'
}
}
我收到的错误:
(dev-test) F:\Personal\xxxx\Learning\Django\projects\jangoproject\devtest>python manage.py startserver
Traceback (most recent call last):
File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in <module>
import psycopg2 as Database
File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\psycopg2\__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.
During handling of the above exception, another exception occurred:
答案 0 :(得分:1)
您可以尝试使用命令
pip install django psycopg2
'ENGINE' : 'django.db.backends.postgresql_psycopg2',
'PORT' : ' '
因此选择了默认端口