diff options
author | dk-15 | 2017-05-26 00:01:35 +0530 |
---|---|---|
committer | dk-15 | 2017-05-26 00:01:35 +0530 |
commit | 6ef013505cd0f28a2ae4a98948fb1913e7f2898c (patch) | |
tree | 3ed15f10269054d10860cafb4b03df80722bf58a /maintenance/management | |
parent | 1fa3368b4662163e6652d5524a0c75bd836705f9 (diff) | |
download | SBHS-2018-Rpi-6ef013505cd0f28a2ae4a98948fb1913e7f2898c.tar.gz SBHS-2018-Rpi-6ef013505cd0f28a2ae4a98948fb1913e7f2898c.tar.bz2 SBHS-2018-Rpi-6ef013505cd0f28a2ae4a98948fb1913e7f2898c.zip |
Add new_cron_job.sh for django 1.11 and include log_generator in maintenance management
Diffstat (limited to 'maintenance/management')
-rw-r--r-- | maintenance/management/__init__.py | 0 | ||||
-rw-r--r-- | maintenance/management/commands/__init__.py | 1 | ||||
-rw-r--r-- | maintenance/management/commands/log_generator.py | 20 |
3 files changed, 21 insertions, 0 deletions
diff --git a/maintenance/management/__init__.py b/maintenance/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maintenance/management/__init__.py diff --git a/maintenance/management/commands/__init__.py b/maintenance/management/commands/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/maintenance/management/commands/__init__.py @@ -0,0 +1 @@ + diff --git a/maintenance/management/commands/log_generator.py b/maintenance/management/commands/log_generator.py new file mode 100644 index 0000000..95c03d0 --- /dev/null +++ b/maintenance/management/commands/log_generator.py @@ -0,0 +1,20 @@ +#Dev/KoDe :) + +import csv +import datetime +import os +import sys +from django.core.management.base import BaseCommand, CommandError + +class Command(BaseCommand): + args = '' + help = 'Creates Log' + + def handle(self, *args, **options): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sbhs_server.settings") # To make a Django Environment. + + from sbhs_server.tables.models import Board + board_details = Board.objects.values_list("online", flat=True) + board = str([x for x in board_details]) + with open('new.csv', "a") as newcsv: + newcsv.write("{0} {1} \n".format(datetime.datetime.now(), board.replace(",", "").replace("[", "").replace("]",""))) |