A library to create periodic, cron-like tasks or single tasks with a specified execution/start time and schedule it to run in the future.
- Install using pip:
pip install django-future-tasks- Add the library to your INSTALLED_APPS list.
INSTALLED_APPS = [
...
'django_future_tasks',
...
]- Configure the task types in your
settings.pyaccording to your needs:
# within settings.py
FUTURE_TASK_TYPE_ONE = "task_one"
FUTURE_TASK_TYPE_TWO = "task_two"
FUTURE_TASK_TYPES = (
(FUTURE_TASK_TYPE_ONE, _("Task 1")),
(FUTURE_TASK_TYPE_TWO, _("Task 2")),
)To receive a signal, register a receiver function using the signal future_task_signal and the task type as sender.
The instance is the FutureTask object.
@receiver(future_task_signal, sender=intern(settings.FUTURE_TASK_TYPE_ONE))
def my_function(sender, instance, **kwargs):
# do somethingCommand for starting the future task processing
python manage.py process_future_tasksCommand for starting the periodic future task processing
python manage.py populate_periodic_future_tasksIf your project uses an older version of Django or Django Rest Framework, you can choose an older version of this project.
| This Project | Python Version | Django Version |
|---|---|---|
| 1.3.* | 3.9, 3.10, 3.11, 3.12, 3.13 | 4.2, 5.0, 5.1 |
| 1.2.* | 3.8, 3.9, 3.10, 3.11 | 3.2, 4.1, 4.2 |
| 1.1.* | 3.8, 3.9, 3.10, 3.11 | 3.2, 4.1, 4.2 |
| 1.0.* | 3.8, 3.9, 3.10, 3.11 | 3.2, 4.0, 4.1 |