An app that provides django integration for RQ (Redis Queue)
—
Web-based monitoring interface for queues, jobs, workers, and statistics with Django admin integration. Provides a comprehensive dashboard for managing and monitoring RQ operations.
Include Django-RQ URLs in your Django application.
# urls.py
from django.urls import path, include
urlpatterns = [
path('django-rq/', include('django_rq.urls')),
# other URL patterns...
]Core views for monitoring queue status and operations.
def stats(request):
"""
Main statistics dashboard showing overview of all queues.
Displays:
- Queue status and job counts
- Worker information
- Failed job summaries
- Scheduler status
URL: /django-rq/
"""
def stats_json(request, token=None):
"""
JSON API endpoint for statistics data.
Args:
token: Optional API token for authentication
Returns:
JsonResponse: Queue statistics in JSON format
URL: /django-rq/stats.json
"""Views for managing individual queues and their jobs.
def jobs(request, queue_index):
"""
List queued jobs for a specific queue.
Args:
queue_index: Index of queue in QUEUES_LIST
Features:
- Pagination (100 jobs per page)
- Job details and metadata
- Bulk actions (delete, requeue)
URL: /django-rq/queues/{queue_index}/
"""
def finished_jobs(request, queue_index):
"""
List completed jobs for a specific queue.
Features:
- Sortable by completion time
- Job result inspection
- Pagination support
URL: /django-rq/queues/{queue_index}/finished/
"""
def failed_jobs(request, queue_index):
"""
List failed jobs for a specific queue.
Features:
- Error details and stack traces
- Requeue functionality
- Bulk operations
URL: /django-rq/queues/{queue_index}/failed/
"""
def scheduled_jobs(request, queue_index):
"""
List scheduled jobs for a specific queue.
Features:
- Next execution time
- Schedule information
- Manual triggering
URL: /django-rq/queues/{queue_index}/scheduled/
"""
def started_jobs(request, queue_index):
"""
List currently running jobs for a specific queue.
Features:
- Job progress information
- Worker assignment
- Stop job functionality
URL: /django-rq/queues/{queue_index}/started/
"""
def deferred_jobs(request, queue_index):
"""
List deferred jobs for a specific queue.
Features:
- Dependency information
- Manual enqueueing
- Dependency resolution
URL: /django-rq/queues/{queue_index}/deferred/
"""Views for individual job management and inspection.
def job_detail(request, queue_index, job_id):
"""
Detailed view of a specific job.
Args:
queue_index: Index of queue
job_id: Unique job identifier
Features:
- Job metadata and arguments
- Execution results
- Error information
- Dependency graph
URL: /django-rq/queues/{queue_index}/{job_id}/
"""
def delete_job(request, queue_index, job_id):
"""
Delete a specific job.
Features:
- Confirmation dialog
- Remove from queue and registries
- Cascade delete for dependent jobs
URL: /django-rq/queues/{queue_index}/{job_id}/delete/
"""
def requeue_job_view(request, queue_index, job_id):
"""
Requeue a failed or finished job.
Features:
- Preserve original arguments
- Reset job status
- Update metadata
URL: /django-rq/queues/{queue_index}/{job_id}/requeue/
"""
def stop_job(request, queue_index, job_id):
"""
Stop a currently running job.
Features:
- Send stop signal to worker
- Update job status
- Handle graceful shutdown
URL: /django-rq/queues/{queue_index}/{job_id}/stop/
"""Views for monitoring and managing workers.
def workers(request, queue_index):
"""
List workers for a specific queue.
Features:
- Worker status and statistics
- Current job information
- Performance metrics
URL: /django-rq/workers/{queue_index}/
"""
def worker_details(request, queue_index, key):
"""
Detailed view of a specific worker.
Args:
queue_index: Index of queue
key: Worker key identifier
Features:
- Worker statistics
- Job history
- Performance metrics
- Current job details
URL: /django-rq/workers/{queue_index}/{key}/
"""Views for performing bulk operations on jobs.
def clear_queue(request, queue_index):
"""
Clear all jobs from a queue.
Features:
- Confirmation dialog
- Bulk job deletion
- Queue statistics update
URL: /django-rq/queues/{queue_index}/empty/
"""
def requeue_all(request, queue_index):
"""
Requeue all failed jobs in a queue.
Features:
- Batch requeue operation
- Progress tracking
- Error handling
URL: /django-rq/queues/{queue_index}/requeue-all/
"""
def delete_failed_jobs(request, queue_index):
"""
Delete all failed jobs from a queue.
Features:
- Bulk deletion
- Confirmation dialog
- Statistics update
URL: /django-rq/queues/{queue_index}/failed/clear/
"""
def actions(request, queue_index):
"""
Process bulk actions on selected jobs.
Supported actions:
- Delete multiple jobs
- Requeue multiple jobs
- Stop multiple running jobs
URL: /django-rq/queues/actions/{queue_index}/
"""Enable Django admin integration for RQ management.
# settings.py
RQ_SHOW_ADMIN_LINK = True # Show RQ link in Django admin
# Admin class for queue management
class QueueAdmin:
"""
Django admin integration for RQ queue management.
Features:
- Read-only queue listing
- Direct link to RQ dashboard
- Permission-based access control
"""
def has_add_permission(self, request):
return False # Prevent creating queues via admin
def changelist_view(self, request, extra_context=None):
# Proxy to RQ stats view
return stats_views.stats(request)Control access to RQ dashboard through Django's permission system.
# Required permissions
- django_rq.view_queue: Access to RQ dashboard
- is_staff: Required for all RQ views
- API token: Alternative authentication for API endpointsJSON endpoints for programmatic access to queue statistics.
def stats_json(request, token=None):
"""
Get queue statistics in JSON format.
Authentication:
- Django staff user session
- Bearer token in Authorization header
- URL token parameter (deprecated)
Response format:
{
"queues": [
{
"name": "default",
"jobs": 0,
"workers": 1,
"finished_jobs": 10,
"failed_jobs": 2,
"started_jobs": 0,
"deferred_jobs": 0,
"scheduled_jobs": 5
}
]
}
"""API endpoints support multiple authentication methods:
# Bearer token authentication
headers = {
'Authorization': f'Bearer {api_token}'
}
# Session authentication (for logged-in users)
# Automatic when accessing via browser
# URL token (deprecated)
# /django-rq/stats.json/your-token-here/The dashboard provides real-time monitoring capabilities:
Advanced search and filtering options:
Mobile-friendly interface with:
Configure dashboard behavior through Django settings:
# settings.py
RQ_SHOW_ADMIN_LINK = True # Show admin link
RQ_API_TOKEN = 'your-secret-token' # API access token
# Custom templates
TEMPLATES = [
{
'DIRS': ['templates/'], # Override RQ templates
# ... other template settings
}
]Override default templates for custom styling:
templates/
└── django_rq/
├── base.html # Base template
├── stats.html # Main dashboard
├── jobs.html # Job listings
├── job_detail.html # Job details
└── workers.html # Worker listingsCustomize URL patterns for the dashboard:
# Custom URL configuration
from django_rq import views, stats_views
custom_patterns = [
path('rq/', stats_views.stats, name='rq_home'),
path('rq/api/', stats_views.stats_json, name='rq_api'),
# ... other custom patterns
]Install with Tessl CLI
npx tessl i tessl/pypi-django-rq