From 41c77ae9eff29749e3637cb8c9bd10f8140e08e9 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Sat, 25 Feb 2023 19:10:23 +0800 Subject: [PATCH] Added token auth --- project/accounts/urls.py | 3 ++- project/api/urls.py | 2 +- project/config/settings.py | 7 +++++++ project/db.sqlite3 | Bin 151552 -> 151552 bytes 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/project/accounts/urls.py b/project/accounts/urls.py index 06cf4c6..d27d046 100644 --- a/project/accounts/urls.py +++ b/project/accounts/urls.py @@ -1,5 +1,6 @@ from django.urls import path, include urlpatterns = [ - path('accounts/', include('djoser.urls')), + path('', include('djoser.urls')), + path('', include('djoser.urls.authtoken')), ] diff --git a/project/api/urls.py b/project/api/urls.py index d608648..845d143 100644 --- a/project/api/urls.py +++ b/project/api/urls.py @@ -3,5 +3,5 @@ from django.urls import path, include urlpatterns = [ path('', include('notes.urls')), - path('accounts/', include('djoser.urls')), + path('accounts/', include('accounts.urls')), ] diff --git a/project/config/settings.py b/project/config/settings.py index 993734b..e99db89 100644 --- a/project/config/settings.py +++ b/project/config/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', + 'rest_framework.authtoken', 'notes.apps.NotesConfig', 'corsheaders', 'djoser' @@ -132,6 +133,12 @@ CORS_ALLOWED_ORIGINS = [ "http://localhost:8000", ] +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.TokenAuthentication', + ), +} + DJOSER = { 'SEND_ACTIVATION_EMAIL': True, 'SEND_CONFIRMATION_EMAIL': True, diff --git a/project/db.sqlite3 b/project/db.sqlite3 index d86ab9cb34bc249dc059ca5cb64f9175b55da3e6..b2a2ba9a97e1446c2a991e8385f53142dd204df4 100644 GIT binary patch delta 1486 zcma)+Pi)&%9LN1)H}Okwe`!Za32SX9DP2gjJljp;WK>P4q6uwk8tAkOQR=4I3QWl~ zmA{MBR$LgT4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