23 lines
735 B
Python
23 lines
735 B
Python
from django.utils.translation import gettext_lazy as _
|
|
from django.apps import AppConfig
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SubscriptionAppConfig(AppConfig):
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
name = 'subscription_app'
|
|
verbose_name = _('subscription_app')
|
|
|
|
def ready(self):
|
|
# 导入调度器
|
|
from .scheduler import start, stop
|
|
try:
|
|
# TODO:: 测试环境不启动调度器
|
|
# start() # 启动调度器
|
|
print('scheduler not start')
|
|
except Exception as e:
|
|
logger.error(f"Error starting the scheduler: {e}")
|
|
|
|
# 你还可以在这里绑定停止调度器的逻辑,例如当 Django 退出时 |