Generate tokens compatible with Django Restframework (drf) from your Django Admin view:
- Create new tokens at will (after being generated, they no longer can be reversed, since only a digest is stored in the database).
- Add expirity dates (supports time and date)
- Remove tokens when you no longer need them.
- Install the python package:
pip install django-apitokens - Add
apitokensto your Django installed apps:
# In your settings.py
INSTALLED_APPS = [
...
'apitokens',
]- Ensure you are using
knoxTokenAuthenticationclass:
# In your settings.py
REST_FRAMEWORK = {
...,
'DEFAULT_AUTHENTICATION_CLASSES': (
'knox.auth.TokenAuthentication',
...,
),
...,
}- You are set to use tokens generated through this app as a way to login with the DRF framework.
To contribute code to this app, ensure you're following the community guidelines

