This commit is contained in:
Mikan
2025-05-19 17:22:00 +03:00
parent a0a337045b
commit d8545bb7cf
6 changed files with 83 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
from datetime import timedelta
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -43,6 +44,8 @@ INSTALLED_APPS = [
'rest_framework',
"django_filters",
'drf_yasg',
'djoser',
'rest_framework_simplejwt',
"core.apps.CoreConfig",
'users.apps.UsersConfig',
"employees.apps.EmployeesConfig",
@@ -171,4 +174,31 @@ REST_FRAMEWORK = {
"PAGE_SIZE": 10,
"DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
"rest_framework.authentication.SessionAuthentication", # Сессионная аутентификация
),
}
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=30),
"REFRESH_TOKEN_LIFETIME": timedelta(days=1),
}
DJOSER = {
"LOGIN_FIELD": "login", # Используем поле login вместо username
"USER_CREATE_PASSWORD_RETYPE": True,
"SET_PASSWORD_RETYPE": True,
"PASSWORD_RESET_CONFIRM_URL": "password/reset/confirm/{uid}/{token}",
"USERNAME_RESET_CONFIRM_URL": "username/reset/confirm/{uid}/{token}",
"ACTIVATION_URL": "activate/{uid}/{token}",
"SEND_ACTIVATION_EMAIL": False, # Отключаем отправку email, если не нужно
"SERIALIZERS": {
"user_create": "users.serializers.AccountSerializer",
"user": "users.serializers.AccountSerializer",
},
}

View File

@@ -43,6 +43,7 @@ urlpatterns = [
path('api/v1/events/', include("events.urls")),
path('api/v1/outreach/', include("outreach.urls")),
path('api/v1/surveys/', include("surveys.urls")),
path('api/v1/users/', include("users.urls")),
path('docs/swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('docs/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),