Files
LXC-Dispatcharr-modificado-…/core/apps.py
T
root f56b088643
Base Image Build / prepare (push) Has been cancelled
Build and Push Multi-Arch Docker Image / build-and-push (push) Has been cancelled
Frontend Tests / test (push) Has been cancelled
Base Image Build / docker (amd64, ubuntu-24.04) (push) Has been cancelled
Base Image Build / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Base Image Build / create-manifest (push) Has been cancelled
Proyecto LCX Dispatcharr multicuenta
2026-05-09 21:24:50 +02:00

49 lines
1.5 KiB
Python

from django.apps import AppConfig
from django.conf import settings
import logging
# Define TRACE level (5 is below DEBUG which is 10)
TRACE = 5
logging.addLevelName(TRACE, "TRACE")
# Add trace method to the Logger class
def trace(self, message, *args, **kwargs):
"""Log a message with TRACE level (more detailed than DEBUG)"""
if self.isEnabledFor(TRACE):
self._log(TRACE, message, args, **kwargs)
# Add the trace method to the Logger class
logging.Logger.trace = trace
class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
def ready(self):
# Import signals to ensure they get registered
import core.signals
from dispatcharr.app_initialization import should_skip_initialization
# Sync developer notifications and check for version updates on startup
# Only run in the main process (not in management commands, migrations, or workers)
if should_skip_initialization():
return
self._sync_developer_notifications()
def _sync_developer_notifications(self):
"""Sync developer notifications from JSON file to database."""
from django.db import connection
import logging
logger = logging.getLogger(__name__)
try:
from core.developer_notifications import sync_developer_notifications
sync_developer_notifications()
except Exception as e:
logger.warning(f"Failed to sync developer notifications on startup: {e}")