Commit e48b4ae 1 parent 5f41645 commit e48b4ae Copy full SHA for e48b4ae
File tree 4 files changed +92
-0
lines changed
website/management/commands
4 files changed +92
-0
lines changed Original file line number Diff line number Diff line change
1
+ import logging
2
+
3
+ from django .core .management .base import BaseCommand
4
+
5
+ # from django.core import management
6
+ from django .utils import timezone
7
+
8
+ logger = logging .getLogger (__name__ )
9
+
10
+
11
+ class Command (BaseCommand ):
12
+ help = "Runs commands scheduled to execute daily"
13
+
14
+ def handle (self , * args , ** options ):
15
+ try :
16
+ logger .info (f"Starting daily scheduled tasks at { timezone .now ()} " )
17
+
18
+ # Add commands to be executed daily
19
+ # management.call_command('daily_command1')
20
+ # management.call_command('daily_command2')
21
+ except Exception as e :
22
+ logger .error (f"Error in daily tasks: { str (e )} " )
23
+ raise
Original file line number Diff line number Diff line change
1
+ import logging
2
+
3
+ from django .core .management .base import BaseCommand
4
+
5
+ # from django.core import management
6
+ from django .utils import timezone
7
+
8
+ logger = logging .getLogger (__name__ )
9
+
10
+
11
+ class Command (BaseCommand ):
12
+ help = "Runs commands scheduled to execute hourly"
13
+
14
+ def handle (self , * args , ** options ):
15
+ try :
16
+ logger .info (f"Starting hourly scheduled tasks at { timezone .now ()} " )
17
+
18
+ # We can add hourly commands here
19
+ # management.call_command('hourly_command1')
20
+ # management.call_command('hourly_command2')
21
+ except Exception as e :
22
+ logger .error (f"Error in hourly tasks: { str (e )} " )
23
+ raise
Original file line number Diff line number Diff line change
1
+ import logging
2
+
3
+ from django .core .management .base import BaseCommand
4
+
5
+ # from django.core import management
6
+ from django .utils import timezone
7
+
8
+ logger = logging .getLogger (__name__ )
9
+
10
+
11
+ class Command (BaseCommand ):
12
+ help = "Runs commands scheduled to execute monthly"
13
+
14
+ def handle (self , * args , ** options ):
15
+ try :
16
+ logger .info (f"Starting monthly scheduled tasks at { timezone .now ()} " )
17
+
18
+ # Add commands to be executed monthly
19
+ # management.call_command('monthly_command1')
20
+ # management.call_command('monthly_command2')
21
+ except Exception as e :
22
+ logger .error (f"Error in monthly tasks: { str (e )} " )
23
+ raise
Original file line number Diff line number Diff line change
1
+ import logging
2
+
3
+ from django .core .management .base import BaseCommand
4
+
5
+ # from django.core import management
6
+ from django .utils import timezone
7
+
8
+ logger = logging .getLogger (__name__ )
9
+
10
+
11
+ class Command (BaseCommand ):
12
+ help = "Runs commands scheduled to execute weekly"
13
+
14
+ def handle (self , * args , ** options ):
15
+ try :
16
+ logger .info (f"Starting weekly scheduled tasks at { timezone .now ()} " )
17
+
18
+ # Add commands to be executed weekly
19
+ # management.call_command('weekly_command1')
20
+ # management.call_command('weekly_command2')
21
+ except Exception as e :
22
+ logger .error (f"Error in weekly tasks: { str (e )} " )
23
+ raise
You can’t perform that action at this time.
0 commit comments