Error: must include rest_framework.authtoken in INSTALLED_APPS or set TOKEN_MODEL to None

258 views Asked by At

I have a problem with the rest_framework_simplejwt package. I installed it and configured everything. and I am encountering an error. django.core.exceptions. ImproperlyConfigured: You must include rest_framework.authtoken in INSTALLED_APPS or set TOKEN_MODEL to None.

this is my settings.py

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'dj_rest_auth.jwt_auth.JWTAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.AllowAny',
    ],
    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

REST_AUTH_TOKEN_MODEL = None

REST_USE_JWT = True

SIMPLE_JWT = {
    'ACCESS_TOKEN_LIFETIME': timedelta(hours=1),
    'REFRESH_TOKEN_LIFETIME': timedelta(days=5),
}
2

There are 2 answers

0
meduals On BEST ANSWER

for me just downgrading dj_rest_auth to 2.2.8 version worked. looks like newer versions need different approach

0
Ahmed Almohammed On

If you use Simple JWT, add rest_framework_simplejwt to the installed apps. I highly recommend you read the docs from the link that I posted it will take you step by step