From fdd4e188faaa38f3483d404991f66eafc103399f Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 7 Oct 2015 21:37:36 +0000 Subject: Discard Django router in favor of separate settings files tailored to particular programs (see #713). svn path=/branches/tk705/; revision=6098 --- rpki/gui/script_util.py | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'rpki/gui/script_util.py') 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") -- cgit v1.2.3