https://github.com/anexia/django-future-tasks
A library to create a task with a specified execution/start time and schedule it to run in the future.
https://github.com/anexia/django-future-tasks
async-task django future-tasks hacktoberfest
Last synced: 8 months ago
JSON representation
A library to create a task with a specified execution/start time and schedule it to run in the future.
- Host: GitHub
- URL: https://github.com/anexia/django-future-tasks
- Owner: anexia
- License: mit
- Created: 2023-04-18T11:04:14.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T20:17:40.000Z (over 1 year ago)
- Last Synced: 2025-06-06T08:48:12.982Z (8 months ago)
- Topics: async-task, django, future-tasks, hacktoberfest
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Django Future Tasks
[](https://pypi.org/project/django-future-tasks/)
[](https://github.com/anexia/django-future-tasks/actions/workflows/test.yml)
[](https://codecov.io/gh/anexia/django-future-tasks)
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.
## Installation
1. Install using pip:
```sh
pip install django-future-tasks
```
2. Add the library to your INSTALLED_APPS list.
```python
INSTALLED_APPS = [
...
'django_future_tasks',
...
]
```
4. Configure the task types in your `settings.py` according to your needs:
```python
# 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")),
)
```
## Usage
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.
```python
@receiver(future_task_signal, sender=intern(settings.FUTURE_TASK_TYPE_ONE))
def my_function(sender, instance, **kwargs):
# do something
```
**Command for starting the future task processing**
```bash
python manage.py process_future_tasks
```
**Command for starting the periodic future task processing**
```bash
python manage.py populate_periodic_future_tasks
```
## Django Compatibility Matrix
If 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 |