Opened 3 months ago

Last modified 2 weeks ago

#35674 assigned New feature

Provide a check for settings removed (post deprecation) — at Version 5

Reported by: Serafeim Papastefanos Owned by:
Component: Core (System checks) Version: 5.1
Severity: Normal Keywords:
Cc: Ülgen Sarıkavak Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Natalia Bidart)

This ticket was repurposed following the original report and a related forum conversation to provide a check for "outdated settings", meaning those settings that went thru the usual and expected deprecation process and have been removed from the code base. These settings are effectively pointless to have defined, as they no longer have any effect, and even in some cases, having them defined might lead project maintainers to mistakenly believe they are still in effect.

Original report:

Hello friends, I had a DEFAULT_FILE_STORAGE = "storages.backends.s3.S3Storage" in my Django 5.0.8 project. When I upgraded it the project worked but the user-uploaded content was uploaded to the filesystem instead of S3. This happened because my DEFAULT_FILE_STORAGE setting was ignored so it fall back to the STORAGES default (https://docs.djangoproject.com/en/5.0/ref/settings/#storages):

{
    "default": {
        "BACKEND": "django.core.files.storage.FileSystemStorage",
    },
    "staticfiles": {
        "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
    },
}

I know that the release notes mention that these settings are removed but since I fell for it there may be also other users that experience the same problems.

My recommendation is to provide a patch in 5.1 that uses the checks framewortk (https://docs.djangoproject.com/en/5.0/topics/checks/) to make sure that there is no DEFAULT_FILE_STORAGE (and probably a STATICFILES_STORAGE) setting and do not allow starting the project unless the user fixes it.

Change History (5)

comment:1 by Natalia Bidart, 3 months ago

Resolution: wontfix
Status: newclosed

Hello Serafeim Papastefanos, thank you for taking the time to create this report. While I do understand your situation, please note that Django has a strict deprecation policy described in this doc link, where it indicates that a deprecation should last for at least 2 feature releases, including the raising of deprecation warnings accordingly.

There is also a doc describing in detail the recommended steps to upgrade Django to a newer version, which explains how to use the -Wall Python flag to catch and fix deprecations early.

Specifically, in Django 4.2, when running any Django command with this -Wall Python flag, the following deprecation message was being shown:

RemovedInDjango51Warning: The DEFAULT_FILE_STORAGE setting is deprecated. Use STORAGES instead.

Because of the above, and because Django can't possibly add a check for every possible misconfiguration of a Django project, I'll be closing this ticket accordingly.
If you disagree, you can consider starting a new conversation on the Django Forum, where you'll reach a wider audience and likely get extra feedback. More information in the documented guidelines for requesting features.

comment:2 by Serafeim Papastefanos, 3 months ago

Hello Natalia Bidart, I understand and will try to integrate -Wall to my management commands from now on.

Kind regards,
Serafeim

comment:3 by Natalia Bidart, 3 months ago

There is an on-going conversation about a related topic in the Forum so we may re-open this ticket. Further details: https://forum.djangoproject.com/t/deprecation-of-default-file-storage-can-we-easen-the-migration/34284

comment:4 by Tim Graham, 3 months ago

Component: Error reportingCore (System checks)
Easy pickings: unset

comment:5 by Natalia Bidart, 3 months ago

Description: modified (diff)
Resolution: wontfix
Status: closednew
Summary: Provide a check for `DEFAULT_FILE_STORAGE`Provide a check for settings removed (post deprecation)
Triage Stage: UnreviewedAccepted

Edited the description to match what was agreed on the referenced forum topic.

Note: See TracTickets for help on using tickets.
Back to Top