mirror of
https://github.com/hequan2017/seal.git
synced 2026-10-30 20:04:07 +08:00
fix: 修复 246 个 Dependabot 依赖漏洞
- requirements.txt 由 2019 年 pip freeze 快照重写为直接依赖清单(Python>=3.10) - Django 2.2.4 -> 5.2.16,DRF 3.9.2 -> 3.17.2,channels 2.2 -> 4.3,celery 4.1 -> 5.5 - 移除代码未使用的 apache-airflow/tornado/GitPython/numpy/thrift/lxml/SQLAlchemy/Mako/Werkzeug/gevent/autobahn/ipython 等历史依赖(含 system/tests.py 中的 airflow 示例) - 已停维的 django-rest-swagger/DRF coreapi 文档替换为 drf-spectacular - celery.platforms/C_FORCE_ROOT/CELERYBEAT_SCHEDULE 按 celery 5 规范迁移 - asgi.py 迁移至 channels 4 入口写法;graphene-django 升级至 3.x(schema 增加 fields) - static/js/jquery-3.1.1.min.js(XSS 漏洞)替换为 jquery-3.7.1 并更新模板引用
This commit is contained in:
576
seal/settings.py
576
seal/settings.py
@@ -1,301 +1,275 @@
|
||||
"""
|
||||
Django settings for seal project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.1.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '#z!nrh$bn536iwb+#_9cp#lv3s(fdslwud(1()9he3qsnw@rzx'
|
||||
|
||||
# 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',
|
||||
'system.apps.SystemConfig',
|
||||
'assets.apps.AssetsConfig',
|
||||
'k8s.apps.K8sConfig',
|
||||
'sql.apps.SqlConfig',
|
||||
'bootstrap3',
|
||||
'django_celery_results',
|
||||
'django_celery_beat',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'corsheaders',
|
||||
'django_filters',
|
||||
'graphene_django',
|
||||
'channels',
|
||||
'rest_framework_swagger',
|
||||
]
|
||||
|
||||
GRAPHENE = {
|
||||
'SCHEMA': 'seal.schema.schema'
|
||||
}
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'seal.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(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 = 'seal.wsgi.application'
|
||||
AUTH_USER_MODEL = 'system.users'
|
||||
AUTHENTICATION_BACKENDS = ('system.views.CustomBackend',) ## 重新登录验证,增加邮箱名字也可以用作登录
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
||||
|
||||
|
||||
if socket.gethostname().endswith('seal'):
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': '192.168.100.50',
|
||||
'PORT': '3306',
|
||||
'NAME': 'seal',
|
||||
'USER': 'root',
|
||||
'PASSWORD': '123456',
|
||||
}
|
||||
}
|
||||
else:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/
|
||||
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
|
||||
SESSION_COOKIE_SAMESITE = 'Lax'
|
||||
CSRF_COOKIE_SAMESITE = 'Lax'
|
||||
SESSION_COOKIE_AGE = 432000
|
||||
LOGIN_URL = '/auth/login'
|
||||
LANGUAGE_CODE = 'zh-Hans'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
USE_L10N = False
|
||||
USE_TZ = True
|
||||
DATETIME_FORMAT = 'Y-m-d H:i:s'
|
||||
DATE_FORMAT = 'Y-m-d'
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
)
|
||||
|
||||
# logging
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '[argus] %(levelname)s %(asctime)s %(module)s %(message)s'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': sys.stdout,
|
||||
'formatter': 'verbose'
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'tasks': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
'asset': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# 表格table
|
||||
PAGINATION_SETTINGS = {
|
||||
'PAGE_RANGE_DISPLAYED': 3,
|
||||
'MARGIN_PAGES_DISPLAYED': 2,
|
||||
'SHOW_FIRST_PAGE_WHEN_INVALID': True,
|
||||
}
|
||||
|
||||
# 表格table 一页 展示数据
|
||||
DISPLAY_PER_PAGE = 15
|
||||
|
||||
## celery 4
|
||||
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
|
||||
# CELERY_RESULT_BACKEND = 'django-db'
|
||||
CELERY_BROKER_URL = 'redis://localhost:6379/2'
|
||||
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
|
||||
CELERYD_CONCURRENCY = 4
|
||||
CELERY_TIMEZONE = 'Asia/Shanghai'
|
||||
CELERYD_MAX_TASKS_PER_CHILD = 10
|
||||
CELERYD_FORCE_EXECV = True
|
||||
|
||||
# 设置默认不存结果
|
||||
# CELERY_IGNORE_RESULT = True
|
||||
CELERY_CREATE_MISSING_QUEUES = True
|
||||
CELERY_DISABLE_RATE_LIMITS = True
|
||||
CELERYD_TASK_SOFT_TIME_LIMIT = 600
|
||||
|
||||
CELERY_TASK_RESULT_EXPIRES = 600
|
||||
CELERY_ENABLE_UTC = False
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
|
||||
## 钉钉 报警机器人 地址 调用地方为 system.tasks.ding_ding_to_info
|
||||
web_hook_url = ""
|
||||
|
||||
## rest api
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
),
|
||||
'DEFAULT_RENDERER_CLASSES': (
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'rest_framework.renderers.BrowsableAPIRenderer' # 注释掉 可以关闭 api web界面
|
||||
),
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
# 'rest_framework.permissions.AllowAny',
|
||||
'rest_framework.permissions.IsAuthenticated',
|
||||
),
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10,
|
||||
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
|
||||
}
|
||||
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
CORS_ORIGIN_WHITELIST = (
|
||||
'*',
|
||||
)
|
||||
MIDDLEWARE_CLASSES = ('system.views.DisableCSRFCheck',)
|
||||
|
||||
## K8S
|
||||
Token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tdDg4amwiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiMmU1NWQ0MWEtOTI0My0xMWU5LTgzNzAtMDAwYzI5N2I0ZmU3Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.ClrHiRBo9TD9qQGT5xeU-0-Cpqp0ZSQJd9-t3hD6B-YGiY-Al8zrgx8B05Ta9oUHS6cEOz_vYrqXDKm3XDFb6yTzOs5XTUTxvGUKIkZzgYI8aZxkCSYLZa-G-MtsnvbHaZj6XryPCAZhat70XFc0RVmHWC_LnGGzuAdpY2BgdaRHGERTTAYMkK8Ac8vV1s-E-lpsnU3jNgMRANp6v7C50ejjAYVTHnsCquJbIRM0uC7b5RhXbzRaOxNK33bDByDczYwgDIw1DKBaeXf3ABaJdcsQK138YxhrVUvDYy4o6j5obmGotGPrIv9XBhS7kgin289gTq5A6KT7aGmZjZPsYw"
|
||||
APISERVER = 'https://192.168.100.111:6443'
|
||||
|
||||
# django-channels配置
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [("127.0.0.1", 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# 配置ASGI
|
||||
ASGI_APPLICATION = "seal.routing.application"
|
||||
|
||||
SWAGGER_SETTINGS = {
|
||||
# 基础样式
|
||||
# 'SECURITY_DEFINITIONS': {
|
||||
# "basic": {
|
||||
# 'type': 'basic'
|
||||
# }
|
||||
# },
|
||||
'USE_SESSION_AUTH': True,
|
||||
'SECURITY_DEFINITIONS': {
|
||||
'api_key': {
|
||||
'type': 'apiKey',
|
||||
'in': 'header',
|
||||
'name': 'authorization'
|
||||
}
|
||||
},
|
||||
# 如果需要登录才能够查看接口文档, 登录的链接使用restframework自带的.
|
||||
# 'LOGIN_URL': '/api/v1/login/',
|
||||
# 'LOGOUT_URL': 'rest_framework:logout',
|
||||
# 'DOC_EXPANSION': None,
|
||||
# 'SHOW_REQUEST_HEADERS':True,
|
||||
# 'USE_SESSION_AUTH': True,
|
||||
# 'DOC_EXPANSION': 'list',
|
||||
# 接口文档中方法列表以首字母升序排列
|
||||
'APIS_SORTER': 'alpha',
|
||||
# 如果支持json提交, 则接口文档中包含json输入框
|
||||
'JSON_EDITOR': True,
|
||||
# 方法列表字母排序
|
||||
'OPERATIONS_SORTER': 'alpha',
|
||||
'VALIDATOR_URL': None,
|
||||
}
|
||||
"""
|
||||
Django settings for seal project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.1.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '#z!nrh$bn536iwb+#_9cp#lv3s(fdslwud(1()9he3qsnw@rzx'
|
||||
|
||||
# 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',
|
||||
'system.apps.SystemConfig',
|
||||
'assets.apps.AssetsConfig',
|
||||
'k8s.apps.K8sConfig',
|
||||
'sql.apps.SqlConfig',
|
||||
'bootstrap3',
|
||||
'django_celery_results',
|
||||
'django_celery_beat',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'corsheaders',
|
||||
'django_filters',
|
||||
'graphene_django',
|
||||
'channels',
|
||||
'drf_spectacular',
|
||||
]
|
||||
|
||||
GRAPHENE = {
|
||||
'SCHEMA': 'seal.schema.schema'
|
||||
}
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'seal.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(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 = 'seal.wsgi.application'
|
||||
AUTH_USER_MODEL = 'system.users'
|
||||
AUTHENTICATION_BACKENDS = ('system.views.CustomBackend',) ## 重新登录验证,增加邮箱名字也可以用作登录
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
||||
|
||||
|
||||
if socket.gethostname().endswith('seal'):
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': '192.168.100.50',
|
||||
'PORT': '3306',
|
||||
'NAME': 'seal',
|
||||
'USER': 'root',
|
||||
'PASSWORD': '123456',
|
||||
}
|
||||
}
|
||||
else:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/
|
||||
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
|
||||
SESSION_COOKIE_SAMESITE = 'Lax'
|
||||
CSRF_COOKIE_SAMESITE = 'Lax'
|
||||
SESSION_COOKIE_AGE = 432000
|
||||
LOGIN_URL = '/auth/login'
|
||||
LANGUAGE_CODE = 'zh-Hans'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
USE_TZ = True
|
||||
DATETIME_FORMAT = 'Y-m-d H:i:s'
|
||||
DATE_FORMAT = 'Y-m-d'
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
)
|
||||
|
||||
# logging
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '[argus] %(levelname)s %(asctime)s %(module)s %(message)s'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': sys.stdout,
|
||||
'formatter': 'verbose'
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'tasks': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
'asset': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# 表格table
|
||||
PAGINATION_SETTINGS = {
|
||||
'PAGE_RANGE_DISPLAYED': 3,
|
||||
'MARGIN_PAGES_DISPLAYED': 2,
|
||||
'SHOW_FIRST_PAGE_WHEN_INVALID': True,
|
||||
}
|
||||
|
||||
# 表格table 一页 展示数据
|
||||
DISPLAY_PER_PAGE = 15
|
||||
|
||||
## celery 4
|
||||
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
|
||||
# CELERY_RESULT_BACKEND = 'django-db'
|
||||
CELERY_BROKER_URL = 'redis://localhost:6379/2'
|
||||
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
|
||||
CELERYD_CONCURRENCY = 4
|
||||
CELERY_TIMEZONE = 'Asia/Shanghai'
|
||||
CELERYD_MAX_TASKS_PER_CHILD = 10
|
||||
CELERYD_FORCE_EXECV = True
|
||||
|
||||
# 设置默认不存结果
|
||||
# CELERY_IGNORE_RESULT = True
|
||||
CELERY_CREATE_MISSING_QUEUES = True
|
||||
CELERY_DISABLE_RATE_LIMITS = True
|
||||
CELERYD_TASK_SOFT_TIME_LIMIT = 600
|
||||
|
||||
CELERY_TASK_RESULT_EXPIRES = 600
|
||||
CELERY_ENABLE_UTC = False
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
|
||||
## 钉钉 报警机器人 地址 调用地方为 system.tasks.ding_ding_to_info
|
||||
web_hook_url = ""
|
||||
|
||||
## rest api
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
),
|
||||
'DEFAULT_RENDERER_CLASSES': (
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'rest_framework.renderers.BrowsableAPIRenderer' # 注释掉 可以关闭 api web界面
|
||||
),
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
# 'rest_framework.permissions.AllowAny',
|
||||
'rest_framework.permissions.IsAuthenticated',
|
||||
),
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10,
|
||||
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
|
||||
}
|
||||
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
CORS_ORIGIN_WHITELIST = (
|
||||
'*',
|
||||
)
|
||||
MIDDLEWARE_CLASSES = ('system.views.DisableCSRFCheck',)
|
||||
|
||||
## K8S
|
||||
Token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tdDg4amwiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiMmU1NWQ0MWEtOTI0My0xMWU5LTgzNzAtMDAwYzI5N2I0ZmU3Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.ClrHiRBo9TD9qQGT5xeU-0-Cpqp0ZSQJd9-t3hD6B-YGiY-Al8zrgx8B05Ta9oUHS6cEOz_vYrqXDKm3XDFb6yTzOs5XTUTxvGUKIkZzgYI8aZxkCSYLZa-G-MtsnvbHaZj6XryPCAZhat70XFc0RVmHWC_LnGGzuAdpY2BgdaRHGERTTAYMkK8Ac8vV1s-E-lpsnU3jNgMRANp6v7C50ejjAYVTHnsCquJbIRM0uC7b5RhXbzRaOxNK33bDByDczYwgDIw1DKBaeXf3ABaJdcsQK138YxhrVUvDYy4o6j5obmGotGPrIv9XBhS7kgin289gTq5A6KT7aGmZjZPsYw"
|
||||
APISERVER = 'https://192.168.100.111:6443'
|
||||
|
||||
# django-channels配置
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [("127.0.0.1", 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# 配置ASGI
|
||||
ASGI_APPLICATION = "seal.routing.application"
|
||||
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'TITLE': '海豹 API 文档',
|
||||
'VERSION': '1.0.0',
|
||||
'SERVE_INCLUDE_SCHEMA': False,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user