user7636208
user7636208

Reputation:

ImportError: No module named rest_framework_jwt.views

I am using Ubuntu and Django (Python 2.7.12)

I am trying to run python manage.py migrate but an error shows up:

from rest_framework_jwt.views import obtain_jwt_token
ImportError: No module named rest_framework_jwt.views

I have already installed rest like this:

pip install djangorestframework

Any idea about the error?

Upvotes: 17

Views: 29656

Answers (4)

Ailton Oliveira
Ailton Oliveira

Reputation: 56

Try use:

pip install drf-jwt

or

pip3 install drf-jwt

Upvotes: 0

RAHUL GUPTA
RAHUL GUPTA

Reputation: 184

django-restgramework-jwt is deprecated in new version. so kindly follows, pip install djangorestframework-simplejwt

Upvotes: 0

arie
arie

Reputation: 18982

JWT is a separate package, so you need to install it via pip install djangorestframework-jwt.

Note, depending on the version(s) of Python you have installed, you might need to use pip3 instead of pip if you are trying to use this/install it for Python 3.

See the other answer regarding Simple JWT, which replaced JWT in 2019.

Upvotes: 39

bhavin bharathan
bhavin bharathan

Reputation: 107

Be aware that JWT has not been maintained since ~2019. There is a newer project, Simple JWT, that you may use instead, if you need newer features. You can install it with this command:

pip install djangorestframework-simplejwt

Upvotes: 5

Related Questions