mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 00:55:50 +00:00
Bug Fix: Automatic backups not enabled by default on new installations: Added backups app to INSTALLED_APPS and implemented automatic scheduler initialization in BackupsConfig.ready(). The backup scheduler now properly syncs the periodic task on startup, ensuring automatic daily backups are enabled and scheduled immediately on fresh database creation without requiring manual user intervention.
This commit is contained in:
parent
027d114299
commit
e26c1908c5
3 changed files with 32 additions and 0 deletions
|
|
@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- Automatic backups not enabled by default on new installations: Added backups app to `INSTALLED_APPS` and implemented automatic scheduler initialization in `BackupsConfig.ready()`. The backup scheduler now properly syncs the periodic task on startup, ensuring automatic daily backups are enabled and scheduled immediately on fresh database creation without requiring manual user intervention.
|
||||
- Fixed modular Docker Compose deployment and entrypoint/init scripts to properly support `DISPATCHARR_ENV=modular`, use external PostgreSQL/Redis services, and handle port, version, and encoding validation (Closes #324, Fixes #61, #445, #731) - Thanks [@CodeBormen](https://github.com/CodeBormen)
|
||||
- Stream rehash/merge logic now guarantees unique stream_hash and always preserves the stream with the best channel ordering and relationships. This prevents duplicate key errors and ensures the correct stream is retained when merging. (Fixes #892)
|
||||
- Admin URL Conflict with XC Streams: Updated nginx configuration to only redirect exact `/admin` and `/admin/` paths to login in production, preventing interference with stream URLs that use "admin" as a username (e.g., `/admin/password/stream_id` now properly routes to stream handling instead of being redirected).
|
||||
|
|
|
|||
|
|
@ -1,7 +1,37 @@
|
|||
import logging
|
||||
import sys
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BackupsConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "apps.backups"
|
||||
verbose_name = "Backups"
|
||||
|
||||
def ready(self):
|
||||
"""Initialize backup scheduler on app startup."""
|
||||
# Only run in the main process (not in workers, beat, or management commands)
|
||||
if 'runserver' in sys.argv or 'uwsgi' in sys.argv[0] if sys.argv else False:
|
||||
self._sync_backup_scheduler()
|
||||
|
||||
def _sync_backup_scheduler(self):
|
||||
"""Sync backup scheduler task to database."""
|
||||
# Import here to avoid circular imports
|
||||
from core.models import CoreSettings
|
||||
from .scheduler import _sync_periodic_task, DEFAULTS
|
||||
try:
|
||||
# Ensure settings exist with defaults if this is a new install
|
||||
CoreSettings.objects.get_or_create(
|
||||
key="backup_settings",
|
||||
defaults={"name": "Backup Settings", "value": DEFAULTS.copy()}
|
||||
)
|
||||
|
||||
# Always sync the periodic task (handles new installs, updates, or missing tasks)
|
||||
logger.debug("Syncing backup scheduler")
|
||||
_sync_periodic_task()
|
||||
except Exception as e:
|
||||
# Log but don't fail startup if there's an issue
|
||||
logger.warning(f"Failed to initialize backup scheduler: {e}")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|||
INSTALLED_APPS = [
|
||||
"apps.api",
|
||||
"apps.accounts",
|
||||
"apps.backups.apps.BackupsConfig",
|
||||
"apps.channels.apps.ChannelsConfig",
|
||||
"apps.dashboard",
|
||||
"apps.epg",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue