没有其他答案对我有用。我做了pipenv install django-cors-headers
,pipenv install psycopg2-binary
等,直到我的手指没有水泡...
如果您不介意的话,这会有点长;预先感谢...
*settings.py*
# Application definition
INSTALLED_APPS = [
'corsheaders',
'rest_framework',
'rest_framework.authtoken',
'quizzes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles'
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
这是适当级别的Pipfile ...
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "3.6"
[packages]
python-decouple = "*"
"psycopg2" = "*"
django-dotenv = "*"
gunicorn = "*"
whitenoise = "*"
dj-database-url = "*"
djangorestframework = "*"
django = "*"
django-cors-headers = "*"
"psycopg2-binary" = "*"
[dev-packages]
但是我仍然从./manage.py获得回溯line 17
,最终没有名为'corsheaders'的模块...我已经卸载/重新安装了所有东西。任何人有任何想法吗?
答案 0 :(得分:-1)
我遇到了类似的问题-尝试使用pip3 / pip / pipenv安装django-cors-headers
。它为我解决了这个问题。