Opened 7 months ago

Last modified 4 months 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
Pull Requests:18640 build:success

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.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
  • If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (0)

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