From 3ee942c5a8cbe247d8637979104fee4b6ca92e23 Mon Sep 17 00:00:00 2001 From: florimondmanca <florimond.manca@gmail.com> Date: Sun, 21 Oct 2018 23:24:35 +0200 Subject: [PATCH] Fix bug with SendGrid when DEBUG was empty string --- oser_backend/settings/production.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oser_backend/settings/production.py b/oser_backend/settings/production.py index f7a85fa..1211646 100644 --- a/oser_backend/settings/production.py +++ b/oser_backend/settings/production.py @@ -6,7 +6,12 @@ from aws.conf import * from .common import * -DEBUG = os.environ.get('DEBUG', False) +# NOTE: `or False` ensures the value is `False` (the boolean) +# if the value given in environment is false-y (e.g. empty string) +# Otherwise may lead to unexpected bugs. +# For example, SendGrid could send an empty string as the sandbox mode, +# leading to strange 400 Bad Request errors. +DEBUG = os.environ.get('DEBUG', False) or False ALLOWED_HOSTS = [ 'localhost', -- GitLab