django-environ icon indicating copy to clipboard operation
django-environ copied to clipboard

Detect mismatched default data type

Open jayvdb opened this issue 2 years ago • 1 comments

The following does not raise an error:

SECRET_KEY = env.bool('SECRET_KEY', 'some random key')

SECRET_KEY will be the default value of type str.

When someone tries to override the default, it will break.

jayvdb avatar Apr 19 '22 00:04 jayvdb

I notice that get_value (and __call__) has an argument parse_default=False - switching this to default to True may solve the problem.

However, that caused the tests for bytes() to fail, and one other odd error in test_schema. I'll play around with these first.

jayvdb avatar Apr 19 '22 00:04 jayvdb