Skip to main content

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


Download files

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

Source Distribution

django_ez_tasks-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

django_ez_tasks-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

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

Hashes for django_ez_tasks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 172ef667ee1377113d39cb13702ddc1671d24775fe5e70caece1775d2a26dc2b
MD5 0e0e07ae916c4fb63fa648d53a2ce6da
BLAKE2b-256 38d77370b7ed4bf68f8b7b0c3912a4d1a05e15ccdd99bf46f498e88e390f30fe

See more details on using hashes here.

File details

Details for the file django_ez_tasks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_ez_tasks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 612cf7c1271138eb044338abc1799639c97951b661aa5109d82f899ec3237c0b
MD5 00051df92816ae652cacedef57c4927a
BLAKE2b-256 5de4f71e38a76b368f66b4d35931c8d88bf4ca1e0d76b56964ba5a4f5acbd909

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