0
我想設置爲JWT令牌保質期添加JWT_AUTH,所以我加了這對settings.py無法在設定
JWT_AUTH = {
'JWT_EXPIRATION_DELTA': datetime.timedelta(days=30),
}
一旦我添加它的設置,我得到這個錯誤
django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
'JWT_AUTH'有什麼問題? settings.py
INSTALLED_APPS = [
'corsheaders',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'rest_auth.registration',
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
'profiles',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
]
# localhost:8000/
SITE_ID = 9
網址正在調用導入尚未加載的網站框架的視圖。只有候選人是corsheaders,但我不明白這是如何與添加JWT_AUTH字典配合。 – Melvyn
嗯..好吧,我把corsheaders放在'django.contrib.sites'後面。但它也沒有效果。我想你找到了問題所在。 –
您是否也按照[認證後端說明](https://getblimp.github.io/django-rest-framework-jwt/)? – Melvyn