I\'m having issues setting my DEBUG = False
on my deployed server (on heroku).
I don\'t believe I\'ve seen this before, but setting debug to false is not
I also experienced this problem as I was loading the debug setting from an environment variable DEBUG = os.environ.get('DEBUG_MODE'))
.
This set the DEBUG value as a string, not a boolean.
To fix this, I hardcoded DEBUG = False
in my prod settings file.
When you use the module decouple
(pip install python-decouple
) make sure you cast DEBUG to a bool. Thus settings.py should have the following line:
from decouple import config
DEBUG = config('DEBUG', default=False, cast=bool)
where in the .env
file
DEBUG = False # or True
This ended up being an issue with the config variable being "False" instead of False
, and so debug wasn't properly set to the boolean value. Shoutout to @WithNail for helping get to the answer