Commit 20ed1e7a5715e29052a5f319d5c72af4bdfb0d93

Authored by Etienne Pallier
1 parent b4e8963c
Exists in dev

bugfixed time saved in db tables

L'heure sauvegardée dans les tables weatherwatch et sitewatch (updated) était en UTC alors que le django setting est en UTC+1 (France). C'est maintenant la bonne heure qui est sauvée !!!
README.md
... ... @@ -64,7 +64,7 @@ LAST VERSION
64 64  
65 65 Date: 13/03/2018
66 66 By: E. Pallier
67   -Version: 0.16.7
  67 +Version: 0.16.8
68 68 - each agent (envmonitor, majordome, alert) can be started independently with a script (new script start_agent in each agent directory)
69 69 - new command "pyros start" to start pyros in different ways (different options : everything or only some components)
70 70  
... ...
pyros.py 100644 → 100755
  1 +#!/usr/bin/env python3
  2 +
1 3 import sys
2 4 import os
3 5 import subprocess
... ...
simulators/plc/plcSimulator.py 100644 → 100755
  1 +#!/usr/bin/env python3
  2 +
1 3 import os
2 4 import sys
3 5 import json
... ...
src/monitoring/start_agent_monitoring.py
... ... @@ -13,8 +13,12 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings")
13 13 #os.environ['SECRET_KEY'] = 'abc'
14 14 #os.environ['ENVIRONMENT'] = 'production'
15 15 import django
  16 +
16 17 django.setup()
17 18  
  19 +#import datetime
  20 +#print(datetime.datetime.now())
  21 +
18 22 # MONITORING AGENT setup
19 23 agent="monitoring"
20 24  
... ...
src/monitoring/tasks.py
... ... @@ -274,6 +274,8 @@ class Monitoring(Task):
274 274 print("Status received from PLC (read and parsed ok):")
275 275 print(status_plc)
276 276 #return self.saveStatus()
  277 + #print(datetime.datetime.now())
  278 +
277 279 self.saveStatus()
278 280 return True
279 281  
... ...
src/pyros/settings.py
... ... @@ -142,7 +142,7 @@ if not CELERY_TEST:
142 142 'PASSWORD': 'DjangoPyros',
143 143 }
144 144 }
145   -
  145 +
146 146 # CELERY_TEST = False ==> 'TEST' RUN MODE, use pyros_test database
147 147 else:
148 148 DATABASES = {
... ... @@ -178,16 +178,27 @@ AUTH_PASSWORD_VALIDATORS = [
178 178 # Internationalization
179 179 # https://docs.djangoproject.com/en/1.9/topics/i18n/
180 180  
181   -LANGUAGE_CODE = 'en-us'
182 181  
183   -TIME_ZONE = 'UTC'
  182 +#LANGUAGE_CODE = 'en-us'
  183 +LANGUAGE_CODE = 'fr-FR'
  184 +
  185 +#TIME_ZONE = 'UTC'
  186 +TIME_ZONE = 'Europe/Paris'
184 187  
  188 +# If you set this to False, Django will make some optimizations so as not
  189 +# to load the internationalization machinery.
185 190 USE_I18N = True
186 191  
  192 +# If you set this to False, Django will not format dates, numbers and
  193 +# calendars according to the current locale.
187 194 USE_L10N = True
188 195  
189   -USE_TZ = True
190   -
  196 +# EP change
  197 +# If you set this to False, Django will not use timezone-aware datetimes.
  198 +# If true => "updated" fields in weatherwatch or sitewatch will be saved as UTC time
  199 +# If false => "updated" fields in weatherwatch or sitewatch will be saved as UTC+1 time (French time)
  200 +#USE_TZ = True
  201 +USE_TZ = False
191 202  
192 203 # To find the media files {{ MEDIA_URL }}
193 204 MEDIA_URL = '/public/static/media/'
... ...