In my .env file I have
os.environ['HTML_DEBUG'] is always True even if I have
I had to resort to
.lower() == "true" in my config.
HTML_DEBUG = os.environ['HTML_DEBUG']
HTML_DEBUG = HTML_DEBUG.lower() == "true"
Why is HTML_DEBUG being treated as a string ?
When you parse variable from .env then it is in string form i.e
"True" or "False" instead of True or False
In order to use them, convert them in boolean.
You can try this
Define a variable in setting like this DEBUG = env.bool(“DEBUG”)
in .env file
env.bool(“DEBUG”) can be used but in above code snippet
os.environ is being used. In order to use
env.bool an additional package needs to be installed which is
django-environ and then in settings configure
env = environ.Env()
then it can be utilized.