from django_celery_beat.models import PeriodicTask, IntervalSchedule def setup_cron(): schedule, created = IntervalSchedule.objects.get_or_create( every=5, period=IntervalSchedule.SECONDS, ) PeriodicTask.objects.get_or_create( interval=schedule, name='Expephacron', task='cron', )