From 7c6a30f16d8d284d2ba24e1baa360316dcbe5a5f Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Fri, 23 Oct 2015 15:34:11 -0400 Subject: [PATCH] Failing startup if private settings fail to load Squashing private settings import errors leads to wasted developer time when developers expect settings to be in place, and they aren't. This change only loads private settings if the private.py file exists. If there is an error during the import of that file, the application will not start. ECOM-2653 --- cms/envs/devstack.py | 8 ++++---- lms/envs/devstack.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index db003d239b..eb951edc22 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -2,6 +2,8 @@ Specific overrides to the base prod settings to make development easier. """ +from os.path import abspath, dirname, join + from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import # Don't use S3 in devstack, fall back to filesystem @@ -115,10 +117,8 @@ REQUIRE_DEBUG = DEBUG ############################################################################### # See if the developer has any local overrides. -try: - from .private import * # pylint: disable=import-error -except ImportError: - pass +if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')): + from .private import * # pylint: disable=import-error,wildcard-import ##################################################################### # Lastly, run any migrations, if needed. diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 0dd9a187fc..5bdac8bac2 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -1,6 +1,7 @@ """ Specific overrides to the base prod settings to make development easier. """ +from os.path import abspath, dirname, join from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import @@ -219,10 +220,8 @@ CORS_ORIGIN_ALLOW_ALL = True ##################################################################### # See if the developer has any local overrides. -try: - from .private import * # pylint: disable=wildcard-import -except ImportError: - pass +if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')): + from .private import * # pylint: disable=import-error,wildcard-import ##################################################################### # Lastly, run any migrations, if needed.