Added token auth

This commit is contained in:
keannu125 2023-02-25 19:10:23 +08:00
parent fa5bd13ca0
commit 41c77ae9ef
4 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,6 @@
from django.urls import path, include from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('accounts/', include('djoser.urls')), path('', include('djoser.urls')),
path('', include('djoser.urls.authtoken')),
] ]

View file

@ -3,5 +3,5 @@ from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include('notes.urls')), path('', include('notes.urls')),
path('accounts/', include('djoser.urls')), path('accounts/', include('accounts.urls')),
] ]

View file

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'rest_framework', 'rest_framework',
'rest_framework.authtoken',
'notes.apps.NotesConfig', 'notes.apps.NotesConfig',
'corsheaders', 'corsheaders',
'djoser' 'djoser'
@ -132,6 +133,12 @@ CORS_ALLOWED_ORIGINS = [
"http://localhost:8000", "http://localhost:8000",
] ]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
),
}
DJOSER = { DJOSER = {
'SEND_ACTIVATION_EMAIL': True, 'SEND_ACTIVATION_EMAIL': True,
'SEND_CONFIRMATION_EMAIL': True, 'SEND_CONFIRMATION_EMAIL': True,

Binary file not shown.