2025-05-07 18:01:48 +08:00
|
|
|
|
"""
|
|
|
|
|
Django settings for daren_project project.
|
|
|
|
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 5.2.
|
|
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
|
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
import pymysql
|
|
|
|
|
pymysql.install_as_MySQLdb()
|
|
|
|
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
|
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
|
|
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
|
SECRET_KEY = 'django-insecure-aie+z75u&tnnx8@g!2ie+q)qhq1!eg&ob!c1(e1vr!eclh+xv6'
|
|
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
|
'django.contrib.admin',
|
|
|
|
|
'django.contrib.auth',
|
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
|
'django.contrib.sessions',
|
|
|
|
|
'django.contrib.messages',
|
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
|
'rest_framework.authtoken',
|
|
|
|
|
'rest_framework', # Django REST Framework
|
|
|
|
|
'channels', # WebSocket 支持
|
|
|
|
|
'apps.accounts',
|
|
|
|
|
'apps.knowledge_base',
|
|
|
|
|
'apps.chat',
|
|
|
|
|
'apps.permissions',
|
|
|
|
|
'apps.message',
|
|
|
|
|
'apps.gmail',
|
|
|
|
|
'apps.feishu',
|
|
|
|
|
'apps.common',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'daren_project.urls'
|
|
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
|
{
|
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
|
'DIRS': [BASE_DIR / 'templates'],
|
|
|
|
|
'APP_DIRS': True,
|
|
|
|
|
'OPTIONS': {
|
|
|
|
|
'context_processors': [
|
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'daren_project.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
|
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
|
'default': {
|
|
|
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
|
|
|
'NAME': 'daren',
|
|
|
|
|
'USER': 'root',
|
|
|
|
|
'PASSWORD': '123456',
|
|
|
|
|
'HOST': '127.0.0.1',
|
|
|
|
|
'PORT': '3306',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Password validation
|
|
|
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
|
|
|
|
|
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
|
{
|
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
|
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'zh-hans'
|
|
|
|
|
|
|
|
|
|
TIME_ZONE = 'Asia/Shanghai'
|
|
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
|
|
|
|
|
|
|
|
|
# 静态文件和模板
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
STATICFILES_DIRS = [BASE_DIR / 'static']
|
|
|
|
|
|
|
|
|
|
# Default primary key field type
|
|
|
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
|
|
|
|
|
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
|
|
|
|
|
|
# REST Framework 配置
|
|
|
|
|
REST_FRAMEWORK = {
|
|
|
|
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
|
|
|
# 'rest_framework.authentication.SessionAuthentication',
|
|
|
|
|
'rest_framework.authentication.TokenAuthentication',
|
|
|
|
|
],
|
|
|
|
|
'DEFAULT_PERMISSION_CLASSES': [
|
|
|
|
|
'rest_framework.permissions.IsAuthenticated',
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Channels 配置(WebSocket)
|
|
|
|
|
ASGI_APPLICATION = 'daren_project.asgi.application'
|
|
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
|
'default': {
|
|
|
|
|
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
|
|
|
|
'CONFIG': {
|
|
|
|
|
'hosts': [('127.0.0.1', 6379)],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 日志配置
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 自定义用户模型
|
|
|
|
|
AUTH_USER_MODEL = 'accounts.User'
|
|
|
|
|
|
|
|
|
|
API_BASE_URL = 'http://81.69.223.133:48329'
|
|
|
|
|
SILICON_CLOUD_API_KEY = 'sk-xqbujijjqqmlmlvkhvxeogqjtzslnhdtqxqgiyuhwpoqcjvf'
|
|
|
|
|
GMAIL_WEBHOOK_URL = 'https://27b3-180-159-100-165.ngrok-free.app/api/user/gmail/webhook/'
|
2025-05-07 22:24:02 +08:00
|
|
|
|
APPLICATION_ID = 'd5d11efa-ea9a-11ef-9933-0242ac120006'
|