[Django] #35231: Add system checks for settings types

12 views
Skip to first unread message

Django

unread,
Feb 18, 2024, 4:40:43 PM2/18/24
to django-...@googlegroups.com
#35231: Add system checks for settings types
-------------------------------------+-------------------------------------
Reporter: Alexander | Owner: nobody
Lazarević |
Type: New | Status: new
feature |
Component: Core | Version: dev
(Other) |
Severity: Normal | Keywords: systemchecks
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The discussion about this can be found on the forum at:
https://forum.djangoproject.com/t/make-the-system-check-look-at-the-types-
of-settings/27424

Use system checks to look for sane setting types at the start. Output
would be something like this:

System check identified some issues:
{{{
WARNINGS:
?: (files.W001) The type of CACHE_MIDDLEWARE_SECONDS should be int
(default 600). see https://docs.djangoproject.com/en/dev/ref/settings
/#std-setting-CACHE_MIDDLEWARE_SECONDS
}}}

For some misconfigured settings there will still be an explicit
ImproperlyConfigured exception raised (like The ALLOWED_HOSTS setting must
be a list or a tuple) or an implicit exception like AttributeError: ‘int’
object has no attribute ‘find’ when for example set LANGUAGE_CODE to an
int.

The implementation checks the type of the default value against the type
of the user setting and issues a warning if they don’t match. This works
for most settings, since they do have a default value other than None. For
the ones that have None as the default value, a table is present, that
contains the expected default values.
--
Ticket URL: <https://code.djangoproject.com/ticket/35231>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 18, 2024, 4:40:53 PM2/18/24
to django-...@googlegroups.com
#35231: Add system checks for settings types
-------------------------------------+-------------------------------------
Reporter: Alexander Lazarević | Owner: Alexander
| Lazarević
Type: New feature | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: systemchecks | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexander Lazarević):

* owner: nobody => Alexander Lazarević
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35231#comment:1>

Django

unread,
Feb 20, 2024, 2:23:15 AM2/20/24
to django-...@googlegroups.com
#35231: Add system checks for settings types
-------------------------------------+-------------------------------------
Reporter: Alexander Lazarević | Owner: Alexander
| Lazarević
Type: New feature | Status: closed
Component: Core (Other) | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: systemchecks | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* resolution: => wontfix
* status: assigned => closed

Comment:

Closing as "wontfix" as we haven't reached a consensus on the forum (at
least for now).
--
Ticket URL: <https://code.djangoproject.com/ticket/35231#comment:2>
Reply all
Reply to author
Forward
0 new messages