#35901: settings.DEBUG could reject non-empty string values (or in particular
"off", "no", "0", "disabled", "false", "False")
-----------------------------------+--------------------------------------
Reporter: Sebastian Pipping | Owner: (none)
Type: New feature | Status: closed
Component: Core (Other) | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: typed settings | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Natalia Bidart):
* keywords: security debug => typed settings
* resolution: => wontfix
* status: new => closed
* type: Uncategorized => New feature
Comment:
I agree with Tim and Mariusz that this proposal isn't suitable for Django
(as a core feature). Moreover, I think it qualifies as a duplicate of
#35231 (which is a ticket related to the forum link shared by Tim).
I'll close this as `wontfix` because, if we were to implement a change
that only applies to `DEBUG`, it would be incomplete and inconsistent.
Users would likely request similar handling for every boolean setting.
Even if we made the behavior consistent, I don't believe this parsing
logic belongs in the settings module. Django settings are meant to be
Python files, and the core framework doesn't include functionality for
reading from environment variables.
Another reason for closing as `wontfix` is that there are third-party
packages that handle parsing from env variables effectively. For example,
[
https://django-environ.readthedocs.io/ django-environ] uses
`BOOLEAN_TRUE_STRINGS = ('true', 'on', 'ok', 'y', 'yes', '1')` for bool
logic parsing.
I think it's important to decouple the settings definition (the Python
file where a string is not a bool) from reading settings from external
sources, such as environment variables, INI config files, Puppetfiles,
etc. The former definitely belongs to Django, while the latter is better
suited for third-party packages or custom business logic.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35901#comment:8>