-
Please remember that this app is still in development.
-
Test this app before deploying it in production environments.
django-periodic-tasks
(Periodic Tasks) is a reusable app for Django.
Full documentation for Crontab syntax
can be found here and there.
Nice tool for generation: https://crontab.guru/
A crontab string has five fields for specifying day, date and time followed by the command to be run at that interval.
* * * * *
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
30 0 1 1,6,12 * — 00:30 Hrs on 1st of Jan, June & Dec.
0 20 * 10 1-5 — 8.00 PM every weekday (Mon-Fri) only in Oct.
0 0 1,10,15 * * — midnight on 1st, 10th & 15th of month
5,10 0 10 * 1 — At 12.05,12.10 every Monday & on 10th of every month
git+https://github.com/persollo/django-periodic-tasks.git
INSTALLED_APPS += ['periodic_tasks']
- app
|
+---- periodic_tasks
| |
| |---- __init__.py
| |
| |---- monday_emails.py
|
|---- ...
def periodic_task_send_monday_emails(user_id, email_title=None):
return send_mail(user_id, email_title)
from .monday_emails import periodic_task_send_monday_emails
python manage.py periodic_tasks_run
123, 'Dream big! Work hard!'
@kuyruk.task(queue='kuyruk')
def periodic_task_send_monday_emails(user_id, email_title=None):
return send_mail(user_id, email_title)
Periodic Tasks is licensed under the MIT license (see the LICENSE
file for details).
If you have great ideas for Periodic Tasks, or if you like to improve something, feel free to fork this repository and/or create a pull request. I'm open for suggestions. If you like to discuss something with me, please open an issue.