From d26c4ce5c7368631fff86b0754a3990045688339 Mon Sep 17 00:00:00 2001 From: Fixelx <69038808+Fixelx@users.noreply.github.com> Date: Wed, 1 Jul 2026 00:05:31 +0200 Subject: [PATCH] Update apps.py --- invoices/apps.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/invoices/apps.py b/invoices/apps.py index 9fcacc8..3f2a267 100644 --- a/invoices/apps.py +++ b/invoices/apps.py @@ -1,9 +1,19 @@ from django.apps import AppConfig + class InvoicesConfig(AppConfig): name = "invoices" def ready(self): + import sys + + if any(cmd in sys.argv for cmd in ("migrate", "makemigrations", "shell", "test")): + return + + from django.db import connection + if "django_apscheduler_djangojob" not in connection.introspection.table_names(): + return + from django_apscheduler.jobstores import DjangoJobStore from apscheduler.schedulers.background import BackgroundScheduler from . import scheduler @@ -20,4 +30,4 @@ class InvoicesConfig(AppConfig): replace_existing=True, ) - sched.start() \ No newline at end of file + sched.start()