Stating defaults add complexity when reading the code but does not change Django's behaviour.

Django defines a set of default values that can be overridden in the settings file.

Explicitly overriding the default values with the same value as the default value is redundant.

Redundant settings increase noise when developers are reading the settings file, making the code harder to maintain.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

django-doctorbotsuggested changes just now
settings.py
1
+
MIDDLEWARE =[
2
+
    "django.contrib.sessions.middleware.SessionMiddleware",
3
+
    "django.middleware.common.CommonMiddleware",
4
+
    ...
5
+
]
6
+
USE_TZ = False
Suggested changes
-
USE_TZ = False
-
USE_I18N = True
-
USE_L10N = False
-
EMAIL_HOST = 'localhost'
-
EMAIL_PORT = 25
Commit suggestion

Stating defaults add complexity when reading the code but does not change Django's behaviour.

Read more
7
+
USE_I18N = True
8
+
USE_L10N = False
9
+
EMAIL_HOST = 'localhost'
10
+
EMAIL_PORT = 25
Update settings.py
We're your Django code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code redundant-setting in your pyproject.toml file.

Read more about configuring Code Review Doctor.