backend: add DRF simplejwt package

This commit is contained in:
Andreas Zweili 2021-02-08 10:27:18 +01:00
parent 71cdf24aeb
commit a2deb78452
3 changed files with 13 additions and 2 deletions

View File

@ -50,7 +50,12 @@ INSTALLED_APPS = [
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
'PAGE_SIZE': 10,
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication'
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
}
MIDDLEWARE = [

View File

@ -20,7 +20,10 @@ from django.conf import settings
from django.conf.urls.static import static
from rest_framework import routers
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
)
from backups.urls import router as backups_router
from computers.urls import router as computers_router
from core.urls import router as core_router
@ -49,4 +52,6 @@ urlpatterns = [
path('api/', include(router.urls)),
path('api/', include('rest_framework.urls')),
path('api/admin/', admin.site.urls),
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -1,6 +1,7 @@
wheel
Django==3.1.4
djangorestframework
djangorestframework-simplejwt
pyaml
pytz
django-guardian