Opened 3 months ago
Last modified 2 weeks ago
#35674 assigned New feature
Provide a check for `DEFAULT_FILE_STORAGE` — at Initial Version
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
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.