Update apps.py
This commit is contained in:
+11
-1
@@ -1,9 +1,19 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class InvoicesConfig(AppConfig):
|
class InvoicesConfig(AppConfig):
|
||||||
name = "invoices"
|
name = "invoices"
|
||||||
|
|
||||||
def ready(self):
|
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 django_apscheduler.jobstores import DjangoJobStore
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from . import scheduler
|
from . import scheduler
|
||||||
@@ -20,4 +30,4 @@ class InvoicesConfig(AppConfig):
|
|||||||
replace_existing=True,
|
replace_existing=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
sched.start()
|
sched.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user