Enable browsable API login

This commit is contained in:
2020-01-06 23:05:19 +00:00
parent 095003b943
commit c5b0a93927
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -47,6 +47,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework.authtoken',
'apiserver.api',
]
@@ -139,10 +140,20 @@ if DEBUG:
'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': 20,
'DEFAULT_RENDERER_CLASSES': DEFAULT_RENDERER_CLASSES,
'DEFAULT_AUTHENTICATION_CLASSES': DEFAULT_AUTHENTICATION_CLASSES,
}
LOGGING = {