from django.core.management.base import BaseCommand from django.utils import timezone from schedule import Scheduler class Command(BaseCommand): help = 'Runs scheduled tasks' def handle(self, *args, **options): scheduler = Scheduler() def my_task(): print("This is a scheduled task.") scheduler.every().day.at("10:00").do(my_task) while True: scheduler.run_pending() time.sleep(1)


上一篇:
下一篇:
切换中文