Boolean environment variables are interpreted as strings


#1

hi,
in my django project I am using python-decouple to read variables from a .env file while I am developing locally. there I use DEBUG=True.
nore: the file .env is not commited to github.

in CircleCI I am using environment variables. there I set DEBUG=true.

in my settings.py file I do the following:

...
DEBUG = config('DEBUG', default=False, cast=bool)
...
if not DEBUG:
    # this is done only on heroku (where I set the env var to DEBUG=0)
    "send errors to sentry.io"
...

the result is that I am logging errors in sentry.io while running unit tests on CircleCI. I don’t want to do that…

my impression is that CircleCI interprets DEBUG=true as a string…
note: I also tried DEBUG=True and DEBUG=1, all with the same result.

how do I have to declare environment variable DEBUG to be a boolean?


#2

apologies for this! not a bug. the cause was totally on my side. please close (or delete). thanks, udo


#3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.