Skip to main content

Task scheduling for Django 6.0 task backends

Project description

Django-scheduled-tasks: task scheduling for the Django tasks framework

A Django app that allows scheduling for the Django 6.0 task framework.

Installation & Usage

First, make sure your task backend is setup. I'd recommend starting with the database backend in django-taks.

Then, add the scheduled tasks:

pip install django-scheduled-tasks

Add the django_scheduled_tasks module to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...,
    "django_scheduled_tasks",
]

define some tasks to run periodically, by wrapping around an existing task, either as a decorator or by calling periodic_task directly:

from django.tasks import task
from django_scheduled_tasks import periodic_task
from datetime import timedelta


# note the order of the decorators! Make sure periodic_task is above task
@periodic_task(interval=timedelta(hours=2))
@task
def run_hourly():
    ...


# or call periodic task with a task directly:
@task
def some_existing_task(some_arg: str):
    ...


periodic_task(interval=timedelta(hours=3), call_args=("some_arg_value",), task=some_existing_task)

For cron-style scheduling, use cron_task with a cron expression:

from django_scheduled_tasks import cron_task
from django.tasks import task

# Run at 9am every day
@cron_task(cron_schedule="0 9 * * *")
@task
def daily_report():
    ...


# Run at 9am in a specific timezone
@cron_task(cron_schedule="0 9 * * *", timezone_str="Europe/Brussels")
@task
def timezoned_scheduled_task():
    ...

Lastly, run one instance of the scheduler as a part of your application:

python manage.py run_task_scheduler

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_scheduled_tasks-0.2.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_scheduled_tasks-0.2.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file django_scheduled_tasks-0.2.1.tar.gz.

File metadata

  • Download URL: django_scheduled_tasks-0.2.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_scheduled_tasks-0.2.1.tar.gz
Algorithm Hash digest
SHA256 db356e08b3121ce8018b6616fef91b1e2c680e3e7c1a2113b9d34dcbb6d0a571
MD5 e6a09c6e73333c71ab2449ce67000e58
BLAKE2b-256 ece6d58f165b514a09bc0ba7411c9c0bfce6e41e3050fddf634ac5919c852da0

See more details on using hashes here.

File details

Details for the file django_scheduled_tasks-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_scheduled_tasks-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_scheduled_tasks-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2edde2bccd379441ad84f0881ea688e562b475d7d4b88fc57fa7b6ad8fe7fb0e
MD5 0c96c7663abc38d561c6ef4d15510e16
BLAKE2b-256 69eca683737a4762fbe238d9ccec12bbea525a53ed7ffea30b418749deb0c7a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page