这是错误消息:
> C:\Users\alex\PycharmProjects\strongkong\venv\Scripts\python.exe C:\Users\alex\PycharmProjects\strongkong\manage.py runserver 8000
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\alex\PycharmProjects\strongkong\venv\Lib\site-packages\django\db\backends\postgresql\base.py", line 25, in <module>
import psycopg as Database
ModuleNotFoundError: No module named 'psycopg'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\alex\PycharmProjects\strongkong\venv\Lib\site-packages\django\db\backends\postgresql\base.py", line 27, in <module>
import psycopg2 as Database
ModuleNotFoundError: No module named 'psycopg2'
我已经下载了 psycopg 和 psycopg2 但没有结果。我尝试下载 psycopg-binary 但再次出错。请帮我解决这个问题。'
django.core.exceptions.ImproperlyConfigured:加载 psycopg2 或 psycopg 模块时出错
请使用 pip install "psycopg[二进制]" 之后它将被修复。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'my_django_db', # Database name
'USER': 'postgres', # Default PostgreSQL username
'PASSWORD': 'none', # Your password
'HOST': 'localhost', # Localhost
'PORT': '5432', # Default port
}
}