doorcontrol: Register tasks in post migrate hook to fix uvicorn issue

This commit is contained in:
Adam Goldsmith 2023-11-14 12:51:33 -05:00
parent 6408748c3f
commit a90cd39612

View File

@ -1,4 +1,11 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.db.models.signals import post_migrate
def post_migrate_callback(sender, **kwargs):
from .tasks.scrapehidevents import schedule_tasks
schedule_tasks()
class DoorControlConfig(AppConfig): class DoorControlConfig(AppConfig):
@ -7,6 +14,4 @@ class DoorControlConfig(AppConfig):
verbose_name = "Door Control" verbose_name = "Door Control"
def ready(self): def ready(self):
from .tasks.scrapehidevents import schedule_tasks post_migrate.connect(post_migrate_callback, sender=self)
schedule_tasks()