Skip to content

thelabnyc/django-periodic-tasks

Repository files navigation

django-periodic-tasks

Periodic/cron task scheduling for django-tasks. Backend-agnostic replacement for celery-beat + django-celery-beat.

Installation

pip install django-periodic-tasks

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_periodic_tasks",
]

Usage

Define scheduled tasks

from django_tasks import task
from django_periodic_tasks import scheduled_task

@scheduled_task(cron="0 5 * * *", name="daily-report")
@task()
def daily_report() -> None:
    ...

Run the scheduler

Enable the autostart setting so the scheduler runs as a daemon thread inside your Django process:

# settings.py
PERIODIC_TASKS_AUTOSTART = True

Or run it as a standalone process:

python manage.py run_scheduler

Packages

 
 
 

Contributors

Languages