From 41220ef17275947597d028abfd828d59c2d82061 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Tue, 4 Jul 2017 20:46:42 +0200 Subject: [PATCH] Added bool_env function to retrieve env variable and convert to python boolean --- dynamicweb/settings/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index ba304ff9..29b19c5b 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -17,6 +17,9 @@ gettext = lambda s: s def env(env_name): return os.environ.get(env_name) +def bool_env(val): + """Replaces string based environment values with Python booleans""" + return True if os.environ.get(val, False) == 'True' else False BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -470,7 +473,7 @@ REGISTRATION_MESSAGE = {'subject': "Validation mail", STRIPE_API_PRIVATE_KEY = env('STRIPE_API_PRIVATE_KEY') STRIPE_API_PUBLIC_KEY = env('STRIPE_API_PUBLIC_KEY') -DEBUG = True +DEBUG = bool_env('DEBUG') if DEBUG: from .local import *