#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. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018dbe29f859-c61953dd-3f6b-41ee-a706-34ff991cb0bb-000000%40eu-central-1.amazonses.com.