#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # @Version : Python 3.11.4 # @Software : Sublime Text 4 # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/7 16:10 # @File : init_celery.py # @Description : """ from flask import Flask from celery.schedules import crontab from application.utils import make_celery def init_celery(app: Flask) -> None: celery = make_celery(app) app.celery = celery celery.conf.beat_schedule = { 'update-database-every-day': { 'task': 'application.libs.tasks.task.update_database', 'schedule': crontab(minute='*') # Execute every minute } }