diff options
author | Michael Elkins <melkins@tislabs.com> | 2013-03-13 22:48:00 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2013-03-13 22:48:00 +0000 |
commit | b29bbfd499bebbed54ca4ec8902711421a80b7f8 (patch) | |
tree | d6720a0069f44a290378f980e5414537656d148a /rpkid | |
parent | c31ae280830d6d332b79cf863e04d45558670fa3 (diff) |
check for settings.py in the standard locations if $DJANGO_SETTINGS_MODULE is unset
svn path=/trunk/; revision=5142
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/portal-gui/scripts/rpkigui-sync-users.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-sync-users.py b/rpkid/portal-gui/scripts/rpkigui-sync-users.py index 579c075b..0f15c65d 100644 --- a/rpkid/portal-gui/scripts/rpkigui-sync-users.py +++ b/rpkid/portal-gui/scripts/rpkigui-sync-users.py @@ -2,6 +2,18 @@ Ensure that a web login exists for labuser* resource holder """ +import os +import sys + +# if the environment is not already set up, look in the default places +if not os.getenv("DJANGO_SETTINGS_MODULE"): + os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' + for d in ('/etc/rpki', '/usr/local/etc/rpki'): + if os.path.exists(os.path.join(d, 'settings.py')): + print 'found settings.py in ' + d + sys.path.insert(1, d) + break + from django.contrib.auth.models import User from rpki.gui.app.models import Conf, ConfACL |