Cron Jobs with django-crontab
A snippet showing how to run scheduled tasks with django-crontab.
# settings.py
INSTALLED_APPS = [
# ...
'django_crontab',
]
CRONJOBS = [
('0 2 * * *', 'myapp.management.commands.cleanup_old_data'),
('*/30 * * * *', 'myapp.tasks.send_reminders'),
]
# Install: pip install django-crontab
# Add jobs: python manage.py crontab add
# Remove jobs: python manage.py crontab remove
# Show jobs: python manage.py crontab show
Explanation:
-
django-crontabintegrates Django management commands with system cron. -
Define periodic jobs in
CRONJOBSsetting using cron syntax (minute hour day month weekday). -
Use
python manage.py crontab addto register jobs with system cron.
- Category Utilities & Miscellaneous
- Total Views 362
- Last Modified 15 June, 2026
- Tags #cron #scheduling #utilities #tasks
Previous snippet
Custom Management Command
Next snippet