Response to We’ve all been there: on boolean environment variables.

Environment values are strings. True becomes "True" and False becomes "False".

And, well, what does "False" evaluate to? True. True.
I think the best way to handle settings with Django is to use django-environ.Β  Not only does it handle .env files. It also has a lot of utility methods for converting values to native python types ( bool, list etc..) and using database urls. It's great.

My airbot settings.py uses it. My airbot settings also lets you specify the path for your .env with the ENV_FILE environment variable, so you can create different files for different environments.
Interactions
1
  • Ah, no. I'm just no longer on the IndieWeb. In the future? Maybe. But it's not your outgoing webmentions that are broken in any c…

    reply