Re: [Django] #35674: Provide a check for settings removed (post deprecation) (was: Provide a check for `DEFAULT_FILE_STORAGE`)

6 views
Skip to first unread message

Django

unread,
Sep 2, 2024, 4:47:26 PM9/2/24
to django-...@googlegroups.com
#35674: Provide a check for settings removed (post deprecation)
-------------------------------------+-------------------------------------
Reporter: Serafeim | Owner: (none)
Papastefanos |
Type: New feature | Status: new
Component: Core (System | Version: 5.1
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* resolution: wontfix =>
* stage: Unreviewed => Accepted
* status: closed => new
* summary: Provide a check for `DEFAULT_FILE_STORAGE` => Provide a check
for settings removed (post deprecation)


Old description:

> 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.

New description:

This ticket was repurposed following the original report and a related
[https://forum.djangoproject.com/t/deprecation-of-default-file-storage-
can-we-easen-the-migration/34284/ 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.

--
Comment:

Edited the description to match what was agreed on the referenced forum
topic.
--
Ticket URL: <https://code.djangoproject.com/ticket/35674#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages