Fix for "apps not ready" in Windows and Mac (#116)

This commit is contained in:
Stan Triepels
2023-10-09 22:04:32 +02:00
committed by GitHub
parent bc50219141
commit 54ab399758
5 changed files with 46 additions and 17 deletions
+12 -3
View File
@@ -1,15 +1,24 @@
import ast
from multiprocessing.process import current_process
from django import db
from django import core, db
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
import django_q.tasks
from django.apps.registry import apps
try:
apps.check_apps_ready()
except core.exceptions.AppRegistryNotReady:
import django
django.setup()
from django_q.brokers import Broker, get_broker
from django_q.conf import Conf, logger
from django_q.humanhash import humanize
from django_q.models import Schedule
from django_q.tasks import async_task
from django_q.utils import close_old_django_connections, localtime
@@ -86,7 +95,7 @@ def scheduler(broker: Broker = None):
q_options["broker"] = broker
q_options["group"] = q_options.get("group", s.name or s.id)
kwargs["q_options"] = q_options
s.task = django_q.tasks.async_task(s.func, *args, **kwargs)
s.task = async_task(s.func, *args, **kwargs)
# log it
if not s.task:
logger.error(