feat: 启动时重新加载系统配置json

This commit is contained in:
caoqianming 2023-07-28 17:19:36 +08:00
parent 1d0b43d75f
commit 56bc87c913
1 changed files with 8 additions and 2 deletions

View File

@ -1,9 +1,15 @@
from django.apps import AppConfig
from django.core.cache import cache
class SystemConfig(AppConfig):
name = 'apps.system'
verbose_name = '系统管理'
def ready(self):
import apps.system.signals
def ready(self) -> None:
# 启动时重新加载系统配置json
if cache.get('cache_sysconfig_need_task', True):
from server.settings import get_sysconfig
get_sysconfig(reload=True)
cache.set('cache_sysconfig_need_task', False, timeout=30)
return super().ready()