上传文档相关功能完善,删除会话功能增加
This commit is contained in:
parent
5eb4ccd7fd
commit
b64af631e3
@ -1,296 +1,296 @@
|
|||||||
"""
|
"""
|
||||||
Django settings for role_based_system project.
|
Django settings for role_based_system project.
|
||||||
|
|
||||||
Generated by 'django-admin startproject' using Django 5.1.5.
|
Generated by 'django-admin startproject' using Django 5.1.5.
|
||||||
|
|
||||||
For more information on this file, see
|
For more information on this file, see
|
||||||
https://docs.djangoproject.com/en/5.1/topics/settings/
|
https://docs.djangoproject.com/en/5.1/topics/settings/
|
||||||
|
|
||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# API 配置
|
# API 配置
|
||||||
API_BASE_URL = 'http://180.163.88.62:30331'
|
API_BASE_URL = 'http://81.69.223.133:48329'
|
||||||
|
|
||||||
DEPARTMENT_GROUPS = {
|
DEPARTMENT_GROUPS = {
|
||||||
"技术部": ["开发组", "测试组", "运维组"],
|
"技术部": ["开发组", "测试组", "运维组"],
|
||||||
"产品部": ["产品组", "设计组"],
|
"产品部": ["产品组", "设计组"],
|
||||||
"市场部": ["销售组", "推广组"],
|
"市场部": ["销售组", "推广组"],
|
||||||
"行政部": ["人事组", "财务组"]
|
"行政部": ["人事组", "财务组"]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = 'django-insecure-5f*=0_2did)e(()n58=e#vd5gaf&y$thgt(h6&=p+wm1*r6mb='
|
SECRET_KEY = 'django-insecure-5f*=0_2did)e(()n58=e#vd5gaf&y$thgt(h6&=p+wm1*r6mb='
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
# 开发配置
|
# 开发配置
|
||||||
# DEBUG = True
|
# DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*'] # 仅在开发环境使用
|
ALLOWED_HOSTS = ['*'] # 仅在开发环境使用
|
||||||
# 服务器配置
|
# 服务器配置
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
# ALLOWED_HOSTS = ['frptx.chiyong.fun', 'localhost', '127.0.0.1']
|
# ALLOWED_HOSTS = ['frptx.chiyong.fun', 'localhost', '127.0.0.1']
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'channels',
|
'channels',
|
||||||
'user_management',
|
'user_management',
|
||||||
'channels_redis',
|
'channels_redis',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'corsheaders.middleware.CorsMiddleware', # CORS中间件要放在CommonMiddleware前面
|
'corsheaders.middleware.CorsMiddleware', # CORS中间件要放在CommonMiddleware前面
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware', # 确保这行没有被注释
|
'django.middleware.csrf.CsrfViewMiddleware', # 确保这行没有被注释
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'user_management.middleware.UserActivityMiddleware',
|
'user_management.middleware.UserActivityMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'role_based_system.urls'
|
ROOT_URLCONF = 'role_based_system.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [BASE_DIR / 'templates']
|
'DIRS': [BASE_DIR / 'templates']
|
||||||
,
|
,
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
'django.template.context_processors.debug',
|
'django.template.context_processors.debug',
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
WSGI_APPLICATION = 'role_based_system.wsgi.application'
|
WSGI_APPLICATION = 'role_based_system.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
||||||
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'NAME': 'rolebasedfilemanagement',
|
'NAME': 'rolebasedfilemanagement',
|
||||||
'USER': 'root',
|
'USER': 'root',
|
||||||
'PASSWORD': '123456',
|
'PASSWORD': '123456',
|
||||||
'HOST': 'localhost',
|
'HOST': '127.0.0.1',
|
||||||
'PORT': '3306',
|
'PORT': '3306',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'charset': 'utf8mb4', # 使用 utf8mb4 字符集
|
'charset': 'utf8mb4', # 使用 utf8mb4 字符集
|
||||||
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'; SET innodb_strict_mode=1; SET NAMES utf8mb4;",
|
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'; SET innodb_strict_mode=1; SET NAMES utf8mb4;",
|
||||||
},
|
},
|
||||||
'TEST': {
|
'TEST': {
|
||||||
'CHARSET': 'utf8mb4',
|
'CHARSET': 'utf8mb4',
|
||||||
'COLLATION': 'utf8mb4_unicode_ci',
|
'COLLATION': 'utf8mb4_unicode_ci',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'Asia/Shanghai'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
AUTH_USER_MODEL = 'user_management.User'
|
AUTH_USER_MODEL = 'user_management.User'
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||||
'rest_framework.authentication.TokenAuthentication',
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
],
|
],
|
||||||
'DEFAULT_PERMISSION_CLASSES': [
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
'rest_framework.permissions.IsAuthenticated',
|
'rest_framework.permissions.IsAuthenticated',
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Channels 配置
|
# Channels 配置
|
||||||
ASGI_APPLICATION = "role_based_system.asgi.application"
|
ASGI_APPLICATION = "role_based_system.asgi.application"
|
||||||
|
|
||||||
# Channel Layers 配置
|
# Channel Layers 配置
|
||||||
CHANNEL_LAYERS = {
|
CHANNEL_LAYERS = {
|
||||||
"default": {
|
"default": {
|
||||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||||
"CONFIG": {
|
"CONFIG": {
|
||||||
"hosts": [("127.0.0.1", 6379)],
|
"hosts": [("127.0.0.1", 6379)],
|
||||||
"capacity": 1500, # 消息队列容量
|
"capacity": 1500, # 消息队列容量
|
||||||
"expiry": 10, # 消息过期时间(秒)
|
"expiry": 10, # 消息过期时间(秒)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# CORS 配置
|
# CORS 配置
|
||||||
CORS_ALLOW_ALL_ORIGINS = True
|
CORS_ALLOW_ALL_ORIGINS = True
|
||||||
CORS_ALLOW_CREDENTIALS = True
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
CORS_ALLOWED_ORIGINS = [
|
CORS_ALLOWED_ORIGINS = [
|
||||||
"http://localhost:8000",
|
"http://localhost:8000",
|
||||||
"http://127.0.0.1:8000",
|
"http://127.0.0.1:8000",
|
||||||
"http://124.222.236.141:8000",
|
"http://124.222.236.141:8000",
|
||||||
"ws://localhost:8000", # 添加 WebSocket
|
"ws://localhost:8000", # 添加 WebSocket
|
||||||
"ws://127.0.0.1:8000", # 添加 WebSocket
|
"ws://127.0.0.1:8000", # 添加 WebSocket
|
||||||
"ws://124.222.236.141:8000", # 添加 WebSocket
|
"ws://124.222.236.141:8000", # 添加 WebSocket
|
||||||
]
|
]
|
||||||
# 允许的请求头
|
# 允许的请求头
|
||||||
CORS_ALLOWED_HEADERS = [
|
CORS_ALLOWED_HEADERS = [
|
||||||
'accept',
|
'accept',
|
||||||
'accept-encoding',
|
'accept-encoding',
|
||||||
'authorization',
|
'authorization',
|
||||||
'content-type',
|
'content-type',
|
||||||
'dnt',
|
'dnt',
|
||||||
'origin',
|
'origin',
|
||||||
'user-agent',
|
'user-agent',
|
||||||
'x-csrftoken',
|
'x-csrftoken',
|
||||||
'x-requested-with',
|
'x-requested-with',
|
||||||
]
|
]
|
||||||
|
|
||||||
# 允许的请求方法
|
# 允许的请求方法
|
||||||
CORS_ALLOWED_METHODS = [
|
CORS_ALLOWED_METHODS = [
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'GET',
|
'GET',
|
||||||
'OPTIONS',
|
'OPTIONS',
|
||||||
'PATCH',
|
'PATCH',
|
||||||
'POST',
|
'POST',
|
||||||
'PUT',
|
'PUT',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# WebSocket 允许的来源
|
# WebSocket 允许的来源
|
||||||
CSRF_TRUSTED_ORIGINS = [
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
'http://localhost:8000',
|
'http://localhost:8000',
|
||||||
'http://127.0.0.1:8000',
|
'http://127.0.0.1:8000',
|
||||||
'http://124.222.236.141:8000',
|
'http://124.222.236.141:8000',
|
||||||
'ws://localhost:8000', # 添加 WebSocket
|
'ws://localhost:8000', # 添加 WebSocket
|
||||||
'ws://127.0.0.1:8000', # 添加 WebSocket
|
'ws://127.0.0.1:8000', # 添加 WebSocket
|
||||||
'ws://124.222.236.141:8000', # 添加 WebSocket
|
'ws://124.222.236.141:8000', # 添加 WebSocket
|
||||||
]
|
]
|
||||||
# 服务器配置
|
# 服务器配置
|
||||||
# 静态文件配置
|
# 静态文件配置
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||||
|
|
||||||
# 媒体文件配置
|
# 媒体文件配置
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||||
|
|
||||||
# 文件上传配置
|
# 文件上传配置
|
||||||
FILE_UPLOAD_MAX_MEMORY_SIZE = 10 * 1024 * 1024 # 10MB
|
FILE_UPLOAD_MAX_MEMORY_SIZE = 10 * 1024 * 1024 # 10MB
|
||||||
MAX_UPLOAD_SIZE = 10 * 1024 * 1024 # 10MB
|
MAX_UPLOAD_SIZE = 10 * 1024 * 1024 # 10MB
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'disable_existing_loggers': False,
|
'disable_existing_loggers': False,
|
||||||
'handlers': {
|
'handlers': {
|
||||||
'console': {
|
'console': {
|
||||||
'class': 'logging.StreamHandler',
|
'class': 'logging.StreamHandler',
|
||||||
},
|
},
|
||||||
'file': {
|
'file': {
|
||||||
'class': 'logging.FileHandler',
|
'class': 'logging.FileHandler',
|
||||||
'filename': 'debug.log',
|
'filename': 'debug.log',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'root': {
|
'root': {
|
||||||
'handlers': ['console', 'file'],
|
'handlers': ['console', 'file'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
'loggers': {
|
'loggers': {
|
||||||
'django.security.csrf': {
|
'django.security.csrf': {
|
||||||
'handlers': ['file'],
|
'handlers': ['file'],
|
||||||
'level': 'WARNING',
|
'level': 'WARNING',
|
||||||
'propagate': True,
|
'propagate': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# CSRF 配置
|
# CSRF 配置
|
||||||
CSRF_COOKIE_SECURE = False # 开发环境设置为 False
|
CSRF_COOKIE_SECURE = False # 开发环境设置为 False
|
||||||
CSRF_COOKIE_HTTPONLY = False
|
CSRF_COOKIE_HTTPONLY = False
|
||||||
CSRF_USE_SESSIONS = False
|
CSRF_USE_SESSIONS = False
|
||||||
CSRF_COOKIE_SAMESITE = 'Lax'
|
CSRF_COOKIE_SAMESITE = 'Lax'
|
||||||
CSRF_TRUSTED_ORIGINS = [
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
'http://localhost:8000',
|
'http://localhost:8000',
|
||||||
'http://127.0.0.1:8000',
|
'http://127.0.0.1:8000',
|
||||||
'ws://localhost:8000', # 添加 WebSocket
|
'ws://localhost:8000', # 添加 WebSocket
|
||||||
'ws://127.0.0.1:8000' # 添加 WebSocket
|
'ws://127.0.0.1:8000' # 添加 WebSocket
|
||||||
]
|
]
|
||||||
|
|
||||||
# Session 配置
|
# Session 配置
|
||||||
SESSION_COOKIE_SECURE = False # 开发环境设置为 False
|
SESSION_COOKIE_SECURE = False # 开发环境设置为 False
|
||||||
SESSION_COOKIE_HTTPONLY = True
|
SESSION_COOKIE_HTTPONLY = True
|
||||||
SESSION_COOKIE_SAMESITE = 'Lax'
|
SESSION_COOKIE_SAMESITE = 'Lax'
|
||||||
|
|
||||||
# REST Framework 配置
|
# REST Framework 配置
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||||
'rest_framework.authentication.TokenAuthentication',
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
'rest_framework.authentication.SessionAuthentication', # WebSocket 需要
|
'rest_framework.authentication.SessionAuthentication', # WebSocket 需要
|
||||||
],
|
],
|
||||||
'DEFAULT_PERMISSION_CLASSES': [
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
'rest_framework.permissions.IsAuthenticated',
|
'rest_framework.permissions.IsAuthenticated',
|
||||||
],
|
],
|
||||||
'DEFAULT_PARSER_CLASSES': [
|
'DEFAULT_PARSER_CLASSES': [
|
||||||
'rest_framework.parsers.JSONParser',
|
'rest_framework.parsers.JSONParser',
|
||||||
'rest_framework.parsers.FormParser',
|
'rest_framework.parsers.FormParser',
|
||||||
'rest_framework.parsers.MultiPartParser'
|
'rest_framework.parsers.MultiPartParser'
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,45 @@
|
|||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
from .views import (
|
from .views import (
|
||||||
KnowledgeBaseViewSet,
|
KnowledgeBaseViewSet,
|
||||||
PermissionViewSet,
|
PermissionViewSet,
|
||||||
NotificationViewSet,
|
NotificationViewSet,
|
||||||
verify_token,
|
verify_token,
|
||||||
user_list,
|
user_list,
|
||||||
user_detail,
|
user_detail,
|
||||||
user_update,
|
user_update,
|
||||||
user_delete,
|
user_delete,
|
||||||
change_password,
|
change_password,
|
||||||
RegisterView,
|
RegisterView,
|
||||||
LoginView,
|
LoginView,
|
||||||
LogoutView,
|
LogoutView,
|
||||||
ChatHistoryViewSet
|
ChatHistoryViewSet
|
||||||
)
|
)
|
||||||
|
|
||||||
# 创建路由器
|
# 创建路由器
|
||||||
router = DefaultRouter()
|
router = DefaultRouter()
|
||||||
|
|
||||||
# 注册视图集
|
# 注册视图集
|
||||||
router.register(r'knowledge-bases', KnowledgeBaseViewSet, basename='knowledge-base')
|
router.register(r'knowledge-bases', KnowledgeBaseViewSet, basename='knowledge-bases')
|
||||||
router.register(r'knowledge-bases', KnowledgeBaseViewSet, basename='knowledge-bases')
|
router.register(r'permissions', PermissionViewSet, basename='permission')
|
||||||
router.register(r'permissions', PermissionViewSet, basename='permission')
|
router.register(r'notifications', NotificationViewSet, basename='notification')
|
||||||
router.register(r'notifications', NotificationViewSet, basename='notification')
|
router.register(r'chat-history', ChatHistoryViewSet, basename='chat-history')
|
||||||
router.register(r'chat-history', ChatHistoryViewSet, basename='chat-history')
|
|
||||||
|
# URL patterns
|
||||||
# URL patterns
|
urlpatterns = [
|
||||||
urlpatterns = [
|
# API 路由
|
||||||
# API 路由
|
path('', include(router.urls)),
|
||||||
path('', include(router.urls)),
|
|
||||||
|
# 用户认证相关
|
||||||
# 用户认证相关
|
path('auth/register/', RegisterView.as_view(), name='register'),
|
||||||
path('auth/register/', RegisterView.as_view(), name='register'),
|
path('auth/login/', LoginView.as_view(), name='login'),
|
||||||
path('auth/login/', LoginView.as_view(), name='login'),
|
path('auth/logout/', LogoutView.as_view(), name='logout'),
|
||||||
path('auth/logout/', LogoutView.as_view(), name='logout'),
|
path('auth/verify-token/', verify_token, name='verify-token'),
|
||||||
path('auth/verify-token/', verify_token, name='verify-token'),
|
path('auth/change-password/', change_password, name='change-password'),
|
||||||
path('auth/change-password/', change_password, name='change-password'),
|
|
||||||
|
# 用户管理相关
|
||||||
# 用户管理相关
|
path('users/', user_list, name='user-list'),
|
||||||
path('users/', user_list, name='user-list'),
|
path('users/<str:pk>/', user_detail, name='user-detail'),
|
||||||
path('users/<str:pk>/', user_detail, name='user-detail'),
|
path('users/<str:pk>/update/', user_update, name='user-update'),
|
||||||
path('users/<str:pk>/update/', user_update, name='user-update'),
|
path('users/<str:pk>/delete/', user_delete, name='user-delete'),
|
||||||
path('users/<str:pk>/delete/', user_delete, name='user-delete'),
|
]
|
||||||
]
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user