48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
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.event_survey_emails import send_survey_emails
|
|
from .tasks.scrape import scrape_events, scrape_membershipworks
|
|
from .tasks.simple_history import q_clean_duplicate_history
|
|
from .tasks.ucsAccounts import sync_accounts
|
|
|
|
ensure_scheduled(
|
|
scrape_membershipworks,
|
|
schedule_type=Schedule.HOURLY,
|
|
)
|
|
|
|
ensure_scheduled(
|
|
scrape_events,
|
|
schedule_type=Schedule.HOURLY,
|
|
)
|
|
|
|
ensure_scheduled(
|
|
sync_accounts,
|
|
schedule_type=Schedule.MINUTES,
|
|
minutes=15,
|
|
)
|
|
|
|
ensure_scheduled(
|
|
send_survey_emails,
|
|
schedule_type=Schedule.HOURLY,
|
|
)
|
|
|
|
ensure_scheduled(
|
|
q_clean_duplicate_history,
|
|
schedule_type=Schedule.HOURLY,
|
|
)
|
|
|
|
|
|
class MembershipworksConfig(AppConfig):
|
|
default_auto_field = "django.db.models.BigAutoField"
|
|
name = "membershipworks"
|
|
|
|
def ready(self):
|
|
post_migrate.connect(post_migrate_callback, sender=self)
|