https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
pip install djangorestframework-simplejwt

REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'rest_framework_simplejwt.authentication.JWTAuthentication',
)
...
}

# JWT扩展配置
import datetime
JWT_AUTH = {
# 设置生成jwt token的有效时间
'JWT_EXPIRATION_DELTA': datetime.timedelta(days=7),
}