18π
It seems you are confusing two packages. djangorestframework-jwt
which you have in your requirements.txt is no longer maintained. It provides the rest_framework_jwt.authentication.JSONWebTokenAuthentication
authentication class.
However, the one you are actually using, rest_framework_simplejwt.authentication.JWTAuthentication
, comes from the pip package djangorestframework-simplejwt
So you need to update your requirements.txt. Remove djangorestframework-jwt
and add djangorestframework-simplejwt
6π
for me the djangorestframework-simplejwt
upgrade from 4.4.0
to current latest version 4.6.0
fixed the problem.
pip3 install --upgrade djangorestframework-simplejwt
5π
If anyone still encountering this error, this is the requirements for djangorestframework-simplejwt:
Python (3.6, 3.7, 3.8)
Django (2.0, 2.1, 2.2, 3.0)
Django REST Framework (3.8, 3.9, 3.10)
I downgraded Django & DRF and the problem is solved for me.
pip uninstall django
pip uninstall djangorestframework
pip install --upgrade django==3.0
pip install --upgrade djangorestframework==3.10
pip install djangorestframework-simplejwt
- Django admin dropdown of 1000s of users
- Django filtering based on optional parameters
- Django βCSRF token missing or incorrect
- Trouble with Django sending email though smtp.gmail.com
- How to get user email with python social auth with facebook and save it
- Django β How to show messages under ajax function
- Django: Extends or Include?
0π
I encountered same error when attempting to deploy on Heroku
Upon investigating I found 2 issues in my case:
1] requirements.txt β> This file was not updated and therefore βgit addβ and βgit commitβ did not pickup the new requirement for djangorestframework-simplejwt
So the solution here was to do a fresh pip freeze > requirements.txt, git add/commit and confirm that on Heroku
2] Secondly I found that Heroku was not finding the v4.6.0 which my python3.8 had installed locally. Instead, I had to edit the requirements.txt to v4.4.0 (current on the pypi.org), redo the git add/commit before this problem was resolved
0π
If anyone is still running into this issue using VS Code and running their Django app inside a Docker container, I solved the issue by downgrading my Python version to 3.9, instead of 3.10, and then rebuilding my container.
In your Dockerfile
make sure the FROM python:3.9
matches the current supported version of python on the docs page: https://django-rest-framework-simplejwt.readthedocs.io/en/latest/index.html , in this case, version 3.9
. Mine was set to 3.10
before, which at the time of this writing, isnβt supported. Then re-build your docker image.
docker-compose down
docker-compose up -d --build
Also, if you are using pipenv to manage your packages, change your python version in your Pipfile
, python_version = "3.9"
. Then run pipenv install
to install the change.
- Django update on queryset to change ID of ForeignKey
- Django: Difference between save() and create() from transaction perspective
0π
My issue was also having installed both djangorestframework-jwt and djangorestframework_simplejwt. After unistalling the former my issue was resolved.
- Pycharm (Python IDE) doesn't auto complete Django modules
- Kwargs in Django
- Django REST Framework nested resource key "id" unaccessible
- Django: Lookup by length of text field
- How to send a request to another server in a django view?
0π
You need to restart your machine and install
- pip install djangorestframework-jwt
- pip install djangorestframework-simplejwt
please ensure those libβs install or not
- Makemigrations in dev machine, without database instance
- Django ORM SELECT with join
- How to override a field in the parent class
0π
Depleting virtual environment and creating a new one, install the supported version of drf solved this for me
- How to override my template instead of django admin panel for reset password?
- How can I rename a column label in Django Admin for a field that is a method//property?