Skip to main content

A REST API monitoring tool for Django Q2 queues

Project description

🛡️ 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.

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

Uploaded Source

Built Distribution

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

django_q_monitor-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_q_monitor-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for django_q_monitor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 52cbb7a3791e441d7474f92489332dfe03e52d7b68ec73caf262bdca358a2b60
MD5 34a2aff7fdc0b8f80e218dd6c65f430c
BLAKE2b-256 b1bfcf5213bcdc159261c9a6551923ff4eb32a328538786b8ea0f09d8b2f539c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_q_monitor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63ed693a44bbe3b7f6419600e50b1f195c2f3eaedecf3a2878b9b952c6fc7b8c
MD5 7c1f559ca66e3efe4f3cb1d7fc9a95df
BLAKE2b-256 4d523126b02b44a1da9e0d0e4d73a1677424ae84fa44debb477af0a2aaad1b31

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