Enable browsable API login
This commit is contained in:
parent
095003b943
commit
c5b0a93927
|
@ -47,6 +47,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
|
'rest_framework.authtoken',
|
||||||
'apiserver.api',
|
'apiserver.api',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -139,10 +140,20 @@ if DEBUG:
|
||||||
'rest_framework.renderers.BrowsableAPIRenderer',
|
'rest_framework.renderers.BrowsableAPIRenderer',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DEFAULT_AUTHENTICATION_CLASSES = (
|
||||||
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
|
)
|
||||||
|
|
||||||
|
if DEBUG:
|
||||||
|
DEFAULT_AUTHENTICATION_CLASSES += (
|
||||||
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
)
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||||
'PAGE_SIZE': 20,
|
'PAGE_SIZE': 20,
|
||||||
'DEFAULT_RENDERER_CLASSES': DEFAULT_RENDERER_CLASSES,
|
'DEFAULT_RENDERER_CLASSES': DEFAULT_RENDERER_CLASSES,
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': DEFAULT_AUTHENTICATION_CLASSES,
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
|
|
|
@ -10,4 +10,5 @@ router.register(r'users', views.UserViewSet)
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', include(router.urls)),
|
path('', include(router.urls)),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
path('api-auth/', include('rest_framework.urls')),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user