From 8ff02f614948cea8aeb58ec42047851d6b0abab7 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 16 Jul 2021 04:18:30 +0000 Subject: [PATCH] Enable token auth class --- server/server/settings.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/server/server/settings.py b/server/server/settings.py index 62618eb..0d3cddd 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -143,4 +143,31 @@ USE_TZ = True STATIC_URL = '/static/' + +DEFAULT_RENDERER_CLASSES = ( + 'rest_framework.renderers.JSONRenderer', +) + +if DEBUG: + DEFAULT_RENDERER_CLASSES += ( + 'rest_framework.renderers.BrowsableAPIRenderer', + ) + +DEFAULT_AUTHENTICATION_CLASSES = ( + 'rest_framework.authentication.TokenAuthentication', + ) + +if DEBUG: + DEFAULT_AUTHENTICATION_CLASSES += ( + 'rest_framework.authentication.SessionAuthentication', + ) + +REST_FRAMEWORK = { + 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', + 'PAGE_SIZE': 300, + 'DEFAULT_RENDERER_CLASSES': DEFAULT_RENDERER_CLASSES, + 'DEFAULT_AUTHENTICATION_CLASSES': DEFAULT_AUTHENTICATION_CLASSES, +} + + SITE_ID = 1