Skip to main content

A reusable Django app for monitoring and administering Django 6.0 Tasks API jobs.

Project description

django-taskly

PyPI Python Django License: MIT

A reusable Django app for monitoring and administering Django 6.0 Tasks API jobs.

django-taskly captures task results via signals, persists them as TaskSnapshot records, and provides a real-time monitoring dashboard with statistics, filtering, search, and per-task detail pages — all integrated into the Django admin UI.

Screenshots

Dashboard Task List
Dashboard Task List
Task Detail Task Snapshot (Admin)
Task Detail Task Snapshot

Features

  • Monitoring dashboard — live stats cards (total, successful, failed, slow), slow-tasks table, and recent-tasks table
  • Manual & auto-refresh — one-click refresh button plus a configurable auto-refresh timer (set your own interval, runs until you stop it)
  • Task list with filters — paginated, filterable by status, searchable by task name, with HTMX-powered partial updates
  • Task detail view — full snapshot inspection including timing, attempts, error class, and traceback
  • Django admin integration — browse and inspect snapshots directly from the admin site (read-only)
  • Signal-based automatic capture — listens to task_finished and records results with zero boilerplate
  • Cleanup management command — prune excess snapshots with taskly_cleanup, with --dry-run preview
  • Configurable — control retention limits, slow-task thresholds, and the dashboard title via a single TASKLY dict

Quick Start

1. Install

pip install django-taskly

2. Add to INSTALLED_APPS

INSTALLED_APPS = [
    # ...
    "django_taskly",
]

3. Include the URLs

# urls.py
from django.urls import include, path

urlpatterns = [
    path("admin/", admin.site.urls),
    path("taskly/", include("django_taskly.urls")),
]

4. Run migrations

python manage.py migrate

5. Configure the Django Tasks backend

django-taskly monitors tasks that run through the Django 6.0 Tasks API. Configure at least one backend in your project settings:

TASKS = {
    "default": {
        "BACKEND": "django.tasks.backends.immediate.ImmediateBackend",
    }
}

Visit http://localhost:8000/taskly/ to open the monitoring dashboard.

Configuration

All settings live under a single TASKLY dict. Every key is optional — the values shown below are the defaults:

TASKLY = {
    # Set to False to disable signal-based task capture entirely.
    "ENABLED": True,

    # Tasks that take longer than this (seconds) are flagged as "slow".
    "SLOW_TASK_SECONDS": 5,

    # Maximum number of TaskSnapshot rows to retain in the database.
    "MAX_SNAPSHOTS": 1000,

    # Title displayed in the dashboard header.
    "DASHBOARD_TITLE": "Django Taskly",
}

Settings reference

Key Type Default Description
ENABLED bool True Enable or disable automatic task capture via signals
SLOW_TASK_SECONDS int/float 5 Duration threshold (seconds) above which a task is marked slow
MAX_SNAPSHOTS int 1000 Maximum number of TaskSnapshot rows kept in the database
DASHBOARD_TITLE str "Django Taskly" Title shown in the monitoring dashboard

Dashboard Pages

URL Name Description
/taskly/ dashboard Stats cards, slow tasks, recent tasks
/taskly/tasks/ task_list Paginated, filterable, searchable snapshot list
/taskly/tasks/<task_id>/ task_detail Full detail view for a single snapshot

All pages are staff-only (@staff_member_required) and extend admin/base_site.html for seamless integration with the Django admin.

Navigation buttons are provided on each page to move between the dashboard and the task list.

HTMX partials

These endpoints are used internally for live updates and can also be consumed by custom integrations:

URL Description
/taskly/partials/dashboard-stats/ Stats cards only
/taskly/partials/dashboard-content/ Full dashboard body (stats + tables)
/taskly/partials/task-list/ Task table <tbody> rows

Management Commands

taskly_cleanup

Removes the oldest TaskSnapshot rows that exceed the configured retention limit.

# Delete snapshots beyond the MAX_SNAPSHOTS setting (default: 1000).
python manage.py taskly_cleanup

# Override the retention limit for this run only.
python manage.py taskly_cleanup --max-snapshots 500

# Preview what would be deleted without touching the database.
python manage.py taskly_cleanup --dry-run
Option Description
--max-snapshots N Retain at most N snapshots (overrides the setting for this run)
--dry-run Print the count of snapshots that would be deleted, without deleting

How It Works

  1. Signal capture — When a Django 6.0 task finishes, Django emits a task_finished signal. django-taskly's AppConfig.ready() connects a handler that automatically snapshots the result.

  2. CollectorTaskCollector.snapshot_from_result() reads the TaskResult fields (id, status, timing, errors) and persists them via update_or_create on the TaskSnapshot model.

  3. Dashboard — Views query TaskSnapshot using the custom manager methods (.failed(), .slow(), .recent()) and render HTMX-enabled templates.

  4. Cleanup — The taskly_cleanup command (or TaskCollector.cleanup()) deletes the oldest rows beyond the retention limit.

Requirements

  • Python 3.11+
  • Django 6.0+

No additional runtime dependencies. HTMX is loaded from a CDN by the built-in templates; no JavaScript build step is needed.

Development

git clone https://github.com/acandincer/django-taskly.git
cd django-taskly
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=django_taskly --cov-report=term-missing

# Lint and format
ruff check django_taskly/
ruff format django_taskly/

License

MIT. See LICENSE for details.

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_taskly-0.1.0.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

django_taskly-0.1.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file django_taskly-0.1.0.tar.gz.

File metadata

  • Download URL: django_taskly-0.1.0.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_taskly-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f841747fe6768fde7473c1d32e1ceffd3f974e37020aa5262ec260fe150eaa2b
MD5 fa13f36b16eee0bd5fe623ae83c4398b
BLAKE2b-256 d2e596836ca53576cbb5410998102e75a14fb3acd0d121d0bac886e021b061da

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_taskly-0.1.0.tar.gz:

Publisher: publish.yml on Reyretee/django-taskly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: django_taskly-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_taskly-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bfac65c79ebe724b4a7b13dc172b64749695c22e4d607571b9b962df25bea66
MD5 92d4fbaa6284b756eaf679a31dc7e052
BLAKE2b-256 f1a20ad5ad4d98d3e497bddc7a6e0beea3f47f90b8028cb985fa26bb0fc6b086

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_taskly-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Reyretee/django-taskly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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