A Django app for background task execution with multiple backends.
Project description
Django EZ Tasks
A simple, Django app for managing background tasks with multiple execution backends. Built on Django 6's BackgroundTask API with additional simple backends.
Installation
pip install git+https://github.com/al-eax/django_ez_tasks.git
Quick Start
1. Add to INSTALLED_APPS
In your Django settings.py:
INSTALLED_APPS = [
# ... other apps
"django_ez_tasks",
]
2. Configure Task Backends
Add your task configuration to settings.py:
TASKS = {
"default": {
"BACKEND": "django_ez_tasks.backends.ThreadedBackend",
}
}
Or use ThreadPoolBackend for a managed thread pool with configurable workers:
TASKS = {
"default": {
"BACKEND": "django_ez_tasks.backends.ThreadPoolBackend",
"OPTIONS": {
"max_workers": 4, # Number of threads in the pool
}
}
}
3. Usage
Define a task using the @task decorator:
from django.tasks import task
@task
def send_welcome_email(user_id: int) -> str:
"""Send a welcome email to a new user."""
user = User.objects.get(id=user_id)
# Send email logic here...
return f"Email sent to {user.email}"
# This returns immediately - the task runs in a background thread
result = send_welcome_email.enqueue(user_id=42)
# You can check the result later
print(result.id) # Task ID for tracking
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions, please visit the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ez_tasks-0.1.0.tar.gz.
File metadata
- Download URL: django_ez_tasks-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
172ef667ee1377113d39cb13702ddc1671d24775fe5e70caece1775d2a26dc2b
|
|
| MD5 |
0e0e07ae916c4fb63fa648d53a2ce6da
|
|
| BLAKE2b-256 |
38d77370b7ed4bf68f8b7b0c3912a4d1a05e15ccdd99bf46f498e88e390f30fe
|
File details
Details for the file django_ez_tasks-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_ez_tasks-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
612cf7c1271138eb044338abc1799639c97951b661aa5109d82f899ec3237c0b
|
|
| MD5 |
00051df92816ae652cacedef57c4927a
|
|
| BLAKE2b-256 |
5de4f71e38a76b368f66b4d35931c8d88bf4ca1e0d76b56964ba5a4f5acbd909
|