cmsmanage/membershipworks/apps.py

39 lines
978 B
Python
Raw Normal View History

from django.apps import AppConfig
from django.db.models.signals import post_migrate
def post_migrate_callback(sender, **kwargs):
from django_q.models import Schedule
from cmsmanage.django_q2_helper import ensure_scheduled
from .tasks.scrape import scrape_membershipworks, scrape_events
from .tasks.ucsAccounts import sync_accounts
ensure_scheduled(
"Scrape MembershipWorks Data",
scrape_membershipworks,
schedule_type=Schedule.HOURLY,
)
ensure_scheduled(
"Scrape MembershipWorks Events",
scrape_events,
schedule_type=Schedule.HOURLY,
)
ensure_scheduled(
"Sync UCS Accounts",
sync_accounts,
schedule_type=Schedule.MINUTES,
minutes=15,
)
class MembershipworksConfig(AppConfig):
2022-02-11 13:48:47 -05:00
default_auto_field = "django.db.models.BigAutoField"
name = "membershipworks"
def ready(self):
post_migrate.connect(post_migrate_callback, sender=self)