Skip to content

Instantly share code, notes, and snippets.

@Adarshreddyash
Created August 4, 2020 10:43
Show Gist options
  • Select an option

  • Save Adarshreddyash/2a1fb4753b77707f64955a26adcda8ea to your computer and use it in GitHub Desktop.

Select an option

Save Adarshreddyash/2a1fb4753b77707f64955a26adcda8ea to your computer and use it in GitHub Desktop.
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
# By default we set everything to admin,
# then open endpoints on a case-by-case basis
'rest_framework.permissions.IsAdminUser',
),
'TEST_REQUEST_RENDERER_CLASSES': (
'rest_framework.renderers.MultiPartRenderer',
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.TemplateHTMLRenderer'
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
#sets the pagination to the API endpoint
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20,
}
from datetime import timedelta
JWT_AUTH = {
'JWT_ALLOW_REFRESH': True,
'JWT_EXPIRATION_DELTA': timedelta(hours=1),
#expires in 1 day you can change according to your needs
'JWT_REFRESH_EXPIRATION_DELTA': timedelta(days=1),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment