feat: base redis配置加入conf.py

This commit is contained in:
caoqianming 2023-12-04 17:08:04 +08:00
parent 7bd8d0dd1f
commit 1a09787853
1 changed files with 2 additions and 2 deletions

View File

@ -282,7 +282,7 @@ AUTHENTICATION_BACKENDS = (
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/2", "LOCATION": conf.REDIS_LOCATION,
"OPTIONS": { "OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient", "CLIENT_CLASS": "django_redis.client.DefaultClient",
} }
@ -290,7 +290,7 @@ CACHES = {
} }
# celery配置,celery正常运行必须安装redis # celery配置,celery正常运行必须安装redis
CELERY_BROKER_URL = "redis://127.0.0.1:6379/3" # 任务存储 CELERY_BROKER_URL = conf.CELERY_BROKER_URL # 任务存储
CELERYD_MAX_TASKS_PER_CHILD = 100 # 每个worker最多执行100个任务就会被销毁可防止内存泄露 CELERYD_MAX_TASKS_PER_CHILD = 100 # 每个worker最多执行100个任务就会被销毁可防止内存泄露
CELERY_TIMEZONE = 'Asia/Shanghai' # 设置时区 CELERY_TIMEZONE = 'Asia/Shanghai' # 设置时区
CELERY_ENABLE_UTC = True # 启动时区设置 CELERY_ENABLE_UTC = True # 启动时区设置