mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-28 16:25:44 +08:00
Added Djoser
This commit is contained in:
parent
83682bead6
commit
ab7fb228e3
13 changed files with 340 additions and 3 deletions
0
stude/accounts/__init__.py
Normal file
0
stude/accounts/__init__.py
Normal file
3
stude/accounts/admin.py
Normal file
3
stude/accounts/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
6
stude/accounts/apps.py
Normal file
6
stude/accounts/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AccountsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'accounts'
|
0
stude/accounts/migrations/__init__.py
Normal file
0
stude/accounts/migrations/__init__.py
Normal file
3
stude/accounts/models.py
Normal file
3
stude/accounts/models.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
3
stude/accounts/tests.py
Normal file
3
stude/accounts/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
7
stude/accounts/urls.py
Normal file
7
stude/accounts/urls.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('djoser.urls')),
|
||||
path('', include('djoser.urls.authtoken'))
|
||||
]
|
3
stude/accounts/views.py
Normal file
3
stude/accounts/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
|
@ -2,5 +2,5 @@ from django.contrib import admin
|
|||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
path('accounts/', include('accounts.urls'))
|
||||
]
|
||||
|
|
|
@ -42,6 +42,8 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'djoser',
|
||||
'rest_framework.authtoken',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -72,6 +74,18 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
)
|
||||
}
|
||||
|
||||
DJOSER = {
|
||||
'SEND_ACTIVATION_EMAIL': True,
|
||||
'SEND_CONFIRMATION_EMAIL': True,
|
||||
'ACTIVATION_URL': 'activation/{uid}/{token}',
|
||||
}
|
||||
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
|
||||
|
||||
|
@ -85,6 +99,10 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
EMAIL_HOST = str(os.getenv('EMAIL_HOST'))
|
||||
EMAIL_HOST_USER = str(os.getenv('EMAIL_HOST_USER'))
|
||||
EMAIL_HOST_PASSWORD = str(os.getenv('EMAIL_HOST_PASSWORD'))
|
||||
EMAIL_PORT = str(os.getenv('EMAIL_PORT'))
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||
|
|
|
@ -15,8 +15,9 @@ Including another URLconf
|
|||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/v1/', include('api.urls'))
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue