Skip to main content

🛡️ Django Q Monitor

A reusable Django app that provides a complete REST API to monitor and manage Django Q2 tasks, schedules, and failures.

It decouples the monitoring logic from the backend, allowing you to build custom dashboards (React, Vue, Mobile) without exposing the Django Admin.


🚀 Features

  • Task Monitoring: View execution history, status, args, and results.
  • Schedules: View upcoming scheduled tasks (Cron/Repeated).
  • Failures: Dedicated endpoint for failed tasks.
  • Interactivity:
    • 🔄 Retry: Re-queue failed or finished tasks directly via API.
    • 🧹 Cleanup: Delete old tasks to free up database space.
  • Standard JSON: Built on Django REST Framework.

📦 Installation

1. Install the package

You can install it directly from the source (or PyPI if published):

pip install django-q-monitor
# OR via git for the latest version
pip install git+https://github.com/YOUR_USERNAME/django-q-monitor.git

2. Add to Installed Apps

Add q_monitor and rest_framework to your settings.py:

INSTALLED_APPS = [
    ...
    'rest_framework',
    'django_q',
    'q_monitor',  # <--- Add this
]

3. Include URLs

Map the API endpoints in your project's urls.py:

from django.urls import path, include

urlpatterns = [
    ...
    path('api/monitor/', include('q_monitor.urls')),
]

🔌 API Reference

By default, endpoints are restricted to Admin users (IsAdminUser).

Tasks

Method Endpoint Description
GET /api/monitor/tasks/ List all tasks (ordered by start time).
GET /api/monitor/tasks/{id}/ Retrieve task details.
POST /api/monitor/tasks/{id}/retry/ Action: Re-queue the task with original args.
DELETE /api/monitor/tasks/cleanup/ Action: Delete all finished/failed tasks.

Schedules

Method Endpoint Description
GET /api/monitor/schedules/ List all scheduled jobs.
GET /api/monitor/schedules/{id}/ Retrieve schedule details.

Failures

Method Endpoint Description
GET /api/monitor/failures/ List only failed tasks.

⚙️ Configuration

No extra configuration is needed if Django Q is already set up. The API respects your existing Q_CLUSTER settings.


🛠️ Development

To run this package locally within another project:

  1. Clone the repo.
  2. Install in editable mode:
pip install -e /path/to/django-q-monitor

📄 License

MIT License - feel free to use and modify as needed.


🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.


📧 Contact

For questions or support, please open an issue on GitHub.

Release files for django-q-monitor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-q-monitor 0.1.0
File Size Uploaded
django_q_monitor-0.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-q-monitor 0.1.0
File Interpreter ABI Platform
django_q_monitor-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / django_q_monitor-0.1.0.tar.gz

Download URL django_q_monitor-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
52cbb7a3791e441d7474f92489332dfe03e52d7b68ec73caf262bdca358a2b60
BLAKE2b-256 checksum
How to use checksums
b1bfcf5213bcdc159261c9a6551923ff4eb32a328538786b8ea0f09d8b2f539c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.1

Release files / django_q_monitor-0.1.0-py3-none-any.whl

Download URL django_q_monitor-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63ed693a44bbe3b7f6419600e50b1f195c2f3eaedecf3a2878b9b952c6fc7b8c
BLAKE2b-256 checksum
How to use checksums
4d523126b02b44a1da9e0d0e4d73a1677424ae84fa44debb477af0a2aaad1b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page