Commit d97c8cc8921494c0300d84ae01756b456c494336
1 parent
3b8b3da4
Exists in
master
and in
3 other branches
Adding crontab to do notifications cron job
Showing
3 changed files
with
11 additions
and
3 deletions
Show diff stats
amadeus/settings.py
... | ... | @@ -52,6 +52,7 @@ INSTALLED_APPS = [ |
52 | 52 | 's3direct', |
53 | 53 | 'django_summernote', |
54 | 54 | 'session_security', |
55 | + 'django_crontab', | |
55 | 56 | 'django_cron', |
56 | 57 | |
57 | 58 | 'amadeus', |
... | ... | @@ -176,6 +177,10 @@ CRON_CLASSES = [ |
176 | 177 | 'notifications.cron.Notify' |
177 | 178 | ] |
178 | 179 | |
180 | +CRONJOBS = [ | |
181 | + ('1 */12 * * *', 'notifications.cron.notification_cron') | |
182 | +] | |
183 | + | |
179 | 184 | #SECURITY |
180 | 185 | SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO','https') |
181 | 186 | ... | ... |
notifications/cron.py
... | ... | @@ -4,11 +4,13 @@ from django_cron import CronJobBase, Schedule |
4 | 4 | from .utils import set_notifications |
5 | 5 | |
6 | 6 | class Notify(CronJobBase): |
7 | - RUN_EVERY_MINS = 1 # every minute | |
7 | + RUN_EVERY_MINS = 1440 # every day | |
8 | 8 | |
9 | 9 | schedule = Schedule(run_every_mins=RUN_EVERY_MINS) |
10 | 10 | code = 'amadeus.notification_cron' # a unique code |
11 | 11 | |
12 | 12 | def do(self): |
13 | - print("Hey") | |
14 | - set_notifications() | |
15 | 13 | \ No newline at end of file |
14 | + set_notifications() | |
15 | + | |
16 | +def notification_cron(): | |
17 | + set_notifications() | |
16 | 18 | \ No newline at end of file | ... | ... |