pythondjangoauthenticationjwtdjango-rest-framework-jwt

ImportError: cannot import name 'ugettext' from 'django.utils.translation'


I installed djangorestframework as shown below:

pip install djangorestframework -jwt

Then, I used rest_framework_jwt.views as shown below:

from rest_framework_jwt.views import (
    obtain_jwt_token, 
    refresh_jwt_token, 
    verify_jwt_token
)
...
    path('auth-jwt/', obtain_jwt_token),
    path('auth-jwt-refresh/',refresh_jwt_token),
    path('auth-jwt-verify/', verify_jwt_token),
...

But, I got the error below:

ImportError: cannot import name 'ugettext' from 'django.utils.translation'

So, how can I solve the error?


Solution

  • Upgrading djangorestframework-jwt will solve the error:

    pip install djangorestframework-jwt --upgrade