Implement Djoser library to handle users
This commit is contained in:
parent
a181de664f
commit
eb488c8827
|
@ -1,8 +1,10 @@
|
|||
astroid==2.3.3
|
||||
Django==2.2.7
|
||||
django-cors-headers==3.2.0
|
||||
django-templated-mail==1.1.1
|
||||
djangorestframework==3.10.3
|
||||
djangorestframework-simplejwt==4.3.0
|
||||
djoser==2.0.3
|
||||
isort==4.3.21
|
||||
lazy-object-proxy==1.4.3
|
||||
mccabe==0.6.1
|
||||
|
|
|
@ -38,6 +38,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'djoser',
|
||||
'corsheaders',
|
||||
'segnalibre_app'
|
||||
]
|
||||
|
@ -136,4 +137,8 @@ REST_FRAMEWORK = {
|
|||
),
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE_JWT = {
|
||||
'AUTH_HEADER_TYPES': ('JWT'),
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
from django.urls import path, include
|
||||
from django.conf.urls import url
|
||||
from . import views
|
||||
from rest_framework_simplejwt.views import (
|
||||
TokenObtainPairView,
|
||||
TokenRefreshView,
|
||||
TokenVerifyView)
|
||||
|
||||
prefix = 'v1/'
|
||||
|
||||
urlpatterns = [
|
||||
path(prefix + 'users/', views.UserList.as_view()),
|
||||
path(prefix + 'books/', views.BookList.as_view()),
|
||||
path(prefix +'books/<int:pk>/', views.BookDetail.as_view()),
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
path(prefix + 'auth/token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||
path(prefix + 'auth/refresh', TokenRefreshView.as_view(), name='token_refresh'),
|
||||
path(prefix + 'auth/verify', TokenVerifyView.as_view(), name='token_verify')
|
||||
url(r'^v1/auth/', include('djoser.urls')),
|
||||
url(r'^v1/auth/', include('djoser.urls.jwt')),
|
||||
path('v1/books/', views.BookList.as_view()),
|
||||
path('v1/books/<int:pk>/', views.BookDetail.as_view()),
|
||||
#path('api-auth/', include('rest_framework.urls')),
|
||||
]
|
Loading…
Reference in New Issue