16 lines
519 B
Python
16 lines
519 B
Python
from django.apps import AppConfig
|
|
from django.core.cache import cache
|
|
import threading
|
|
|
|
|
|
class EnmConfig(AppConfig):
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
name = 'apps.enm'
|
|
|
|
def ready(self) -> None:
|
|
# 启动时缓存测点
|
|
if cache.get('cache_mpoint_task', True):
|
|
from .services import cache_mpoints
|
|
threading.Thread(target=cache_mpoints, daemon=True).start()
|
|
cache.set('cache_mpoint_task', False, timeout=30)
|
|
return super().ready() |