From 20ed1e7a5715e29052a5f319d5c72af4bdfb0d93 Mon Sep 17 00:00:00 2001 From: Etienne Pallier <epallier@irap.omp.eu> Date: Tue, 13 Mar 2018 16:48:48 +0100 Subject: [PATCH] bugfixed time saved in db tables --- README.md | 2 +- pyros.py | 2 ++ simulators/plc/plcSimulator.py | 2 ++ src/monitoring/start_agent_monitoring.py | 4 ++++ src/monitoring/tasks.py | 2 ++ src/pyros/settings.py | 21 ++++++++++++++++----- 6 files changed, 27 insertions(+), 6 deletions(-) mode change 100644 => 100755 pyros.py mode change 100644 => 100755 simulators/plc/plcSimulator.py diff --git a/README.md b/README.md index 9e4ae25..7f81b9b 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ LAST VERSION Date: 13/03/2018 By: E. Pallier -Version: 0.16.7 +Version: 0.16.8 - each agent (envmonitor, majordome, alert) can be started independently with a script (new script start_agent in each agent directory) - new command "pyros start" to start pyros in different ways (different options : everything or only some components) diff --git a/pyros.py b/pyros.py old mode 100644 new mode 100755 index 587d085..6bad353 --- a/pyros.py +++ b/pyros.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import sys import os import subprocess diff --git a/simulators/plc/plcSimulator.py b/simulators/plc/plcSimulator.py old mode 100644 new mode 100755 index 9960d61..5e1cdb7 --- a/simulators/plc/plcSimulator.py +++ b/simulators/plc/plcSimulator.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import os import sys import json diff --git a/src/monitoring/start_agent_monitoring.py b/src/monitoring/start_agent_monitoring.py index e087985..86e5c45 100755 --- a/src/monitoring/start_agent_monitoring.py +++ b/src/monitoring/start_agent_monitoring.py @@ -13,8 +13,12 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings") #os.environ['SECRET_KEY'] = 'abc' #os.environ['ENVIRONMENT'] = 'production' import django + django.setup() +#import datetime +#print(datetime.datetime.now()) + # MONITORING AGENT setup agent="monitoring" diff --git a/src/monitoring/tasks.py b/src/monitoring/tasks.py index 3f21861..5e3c508 100644 --- a/src/monitoring/tasks.py +++ b/src/monitoring/tasks.py @@ -274,6 +274,8 @@ class Monitoring(Task): print("Status received from PLC (read and parsed ok):") print(status_plc) #return self.saveStatus() + #print(datetime.datetime.now()) + self.saveStatus() return True diff --git a/src/pyros/settings.py b/src/pyros/settings.py index bc8b982..b3ca1d3 100644 --- a/src/pyros/settings.py +++ b/src/pyros/settings.py @@ -142,7 +142,7 @@ if not CELERY_TEST: 'PASSWORD': 'DjangoPyros', } } - + # CELERY_TEST = False ==> 'TEST' RUN MODE, use pyros_test database else: DATABASES = { @@ -178,16 +178,27 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ -LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +#LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'fr-FR' + +#TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Paris' +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. USE_I18N = True +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale. USE_L10N = True -USE_TZ = True - +# EP change +# If you set this to False, Django will not use timezone-aware datetimes. +# If true => "updated" fields in weatherwatch or sitewatch will be saved as UTC time +# If false => "updated" fields in weatherwatch or sitewatch will be saved as UTC+1 time (French time) +#USE_TZ = True +USE_TZ = False # To find the media files {{ MEDIA_URL }} MEDIA_URL = '/public/static/media/' -- libgit2 0.21.2