aboutsummaryrefslogtreecommitdiff
path: root/rpki/gui/script_util.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-07 21:37:36 +0000
committerRob Austein <sra@hactrn.net>2015-10-07 21:37:36 +0000
commitfdd4e188faaa38f3483d404991f66eafc103399f (patch)
tree9b5201ae4e849115691159a71c1f312275c265ff /rpki/gui/script_util.py
parent63b42d248311fda78e2dc849d8cca0ced7976c82 (diff)
Discard Django router in favor of separate settings files tailored to
particular programs (see #713). svn path=/branches/tk705/; revision=6098
Diffstat (limited to 'rpki/gui/script_util.py')
-rw-r--r--rpki/gui/script_util.py38
1 files changed, 3 insertions, 35 deletions
diff --git a/rpki/gui/script_util.py b/rpki/gui/script_util.py
index 24b6d313..31e40821 100644
--- a/rpki/gui/script_util.py
+++ b/rpki/gui/script_util.py
@@ -24,39 +24,7 @@ def setup():
Configure Django enough to use the ORM.
"""
- # In theory we no longer need to call settings.configure, which
- # probably means this whole module can go away soon, but leave
- # breadcrumbs for now.
+ import os
- if True:
- import os
- os.environ.update(DJANGO_SETTINGS_MODULE = "rpki.django_settings")
-
- else:
- import django
- from rpki import config
- from rpki import autoconf
- from django.conf import settings
-
- cfg = config.parser(section='web_portal')
- # INSTALLED_APPS doesn't seem necessary so long as you are only accessing
- # existing tables.
- settings.configure(
- DATABASES={
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': cfg.get('sql-database'),
- 'USER': cfg.get('sql-username'),
- 'PASSWORD': cfg.get('sql-password'),
- },
- },
- MIDDLEWARE_CLASSES = (),
- DOWNLOAD_DIRECTORY = cfg.get('download-directory', '/var/tmp'),
- )
- # Can't populate apps if we don't know what they are. If this
- # explodes with an AppRegistryNotReady exception, the above comment
- # about not needing to set INSTALLED_APPS is no longer true and
- # you'll need to fix that here.
- if False and django.VERSION >= (1, 7):
- from django.apps import apps
- apps.populate(settings.INSTALLED_APPS)
+ # If this doesn't work, try changing it to "rpki.django_settings.gui".
+ os.environ.update(DJANGO_SETTINGS_MODULE = "rpki.django_settings.irdb")