Monitor Django Management Commands
Not every scheduled Django job goes through Celery — a plain management command invoked by system cron is just as common, and just as easy to monitor with a single ping at the end.
Setup
Create an incoming monitor
Add a heartbeat monitor in Pingtastic with a grace period past the command's schedule interval.
Ping at the end of the command's handle() method
Add the ping call after the command's real work completes successfully.
import requests
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
# ...existing command logic...
requests.get('https://ping.pingtastic.net/ping/nightly-cleanup', timeout=5)Schedule it with system cron
Call manage.py directly with the full path to your virtualenv's Python interpreter.
0 3 * * * cd /path/to/project && /path/to/venv/bin/python manage.py nightly_cleanupGotchas
- ⚠A broken virtualenv path or missing env vars in cron's minimal environment is the single most common reason a working command fails only when run via cron — test the exact crontab line manually in a bare shell, not just interactively.
- ⚠If the command raises before reaching the ping call, no ping fires — correct behavior, but make sure you're not swallowing exceptions earlier in the command that would let it "succeed" despite real work failing.
Questions
How is this different from monitoring a Celery task?
This is for Django apps that run a particular job via plain system cron with no Celery involved at all. See Monitor Django Celery Periodic Tasks if your job goes through Celery Beat instead.
Do I need django-crontab or a similar package?
No — a plain crontab entry calling manage.py is enough. Packages like django-crontab just manage the crontab entries for you; they don't change how monitoring works.
Start monitoring your Django management commands
Set up your first monitor in under five minutes.
Get started — $5/month