diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-06-28 17:30:49 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-06-28 17:30:49 +0000 |
commit | 4df01c08e51dfc0f7a889805ad197f2fd950dcfa (patch) | |
tree | faf9da5045aa91276d078bbe686f98158d3b69dd | |
parent | df9abaa0903bef3567e1e1ad40fcfaa3d8e04298 (diff) |
determine a timezone that is similar to UTC at runtime when settings.py is loaded
svn path=/trunk/; revision=4563
-rw-r--r-- | rpkid/portal-gui/settings.py.in | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rpkid/portal-gui/settings.py.in b/rpkid/portal-gui/settings.py.in index 30cc19a8..8d607480 100644 --- a/rpkid/portal-gui/settings.py.in +++ b/rpkid/portal-gui/settings.py.in @@ -9,6 +9,7 @@ __version__ = '$Id$' import rpki.config +import os.path DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -38,12 +39,22 @@ DATABASES = { } } + +def select_tz(): + "Find a supported timezone that looks like UTC" + for tz in ('UTC', 'GMT', 'Etc/UTC', 'Etc/GMT'): + if os.path.exists('/usr/share/zoneinfo/' + tz): + return tz + # Can't determine the proper timezone, fall back to UTC and let Django + # report the error to the user + return 'UTC' + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. -TIME_ZONE = 'UTC' +TIME_ZONE = select_tz() # Make this unique, and don't share it with anybody. SECRET_KEY = '%(AC_SECRET_KEY)s' |