python - 无法安装 django,我收到 JWT 错误
问题描述
当我尝试安装 django(在 Google 云上)时,我收到以下消息:
File "/root/lplatform/back/lplatform_api/urls.py", line 3, in <module>
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
ModuleNotFoundError: No module named 'rest_framework_simplejwt'
这是我的 url.py 文件:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('lplatform_api.urls'))
]
这是我的setting.py:
REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": (
"rest_framework.permissions.IsAuthenticated",
),
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
'rest_framework.authentication.BasicAuthentication'
, 'rest_framework.authentication.SessionAuthentication',
),
}
当我执行 pip freeze 时,我得到下面的列表,我认为所有需要的依赖项都存在于虚拟环境中:
asn1crypto==0.24.0
cryptography==2.1.4
Django==1.11.29
djangorestframework==3.9.4
djangorestframework-jwt==1.11.0
djangorestframework-simplejwt==4.1.4
enum34==1.1.6
idna==2.6
ipaddress==1.0.17
keyring==10.6.0
keyrings.alt==3.0
pycrypto==2.6.1
pygobject==3.26.1
PyJWT==1.7.1
pytz==2019.3
pyxdg==0.25
SecretStorage==2.3.1
six==1.11.0
解决方案
推荐阅读
- python - 在python中的pandas数据帧上从groupby中选择索引值
- ios - 从 MtlTexture 获取字节以创建 CVPixelBufferRef
- python - 用python在每个子目录中查找文件名中文件名最大的文件?
- php - 这是用 php 自动加载 html 页面的可接受方式吗?
- c++ - main.obj : fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x6
- c# - Serializable class Initialized values are ignored || Unity C#
- android - PAYTM 与我的 APP 集成
- windows - PC/SC & NFC Proximity Provider 冲突?
- dart - How can I populate a stream with a value from a future?
- apache-kafka - 无法使用 kafka-console-consumer.sh 消费消息