Updating old Django version code to version 4


from rest_framework_simplejwt.views import (

path('get_csrftoken_angular/', TokenObtainPairView.as_view(), name='get_csrftoken_angular'),
re_path(r'^refresh-token/', TokenRefreshView.as_view(), name='refresh-token'),

In a new branch, I made several changes to use modern code, in line with the new version of Django and Python, such as changing “url(r’pattern_url’, blablabla” to “re_path(r’’, blablabla)”. Now, I need to know how to change this code snippet below, since instead of “djangorestframework-jwt==1.11.0” I’m using “djangorestframework-simplejwt”:

from rest_framework_jwt.views import obtain_jwt_token
from rest_framework_jwt.views import refresh_jwt_token

According to what I can see by a casual inspection of the docs, djangorestframework-simplejwt is not a drop-in replacement for djangorestframework-jwt.

(See Status · Issue #484 · jpadilla/django-rest-framework-jwt · GitHub for some other information on this.)

You’ll have to read the docs for both packages to see how the two may operate differently to figure out what changes may be needed to your code to work with the newer library.