#34273 closed Uncategorized (invalid)
settings.DEFAULT_FILE_STORAGE is not the same as settings.STORAGES["default"]
Reported by: | אורי | Owned by: | nobody |
---|---|---|---|
Component: | File uploads/storage | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
I ran tests with Django 4.2 alpha and sorl-thumbnail==12.9.0. The tests pass but there is a deprecation warning because sorl-thumbnail uses THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE
. I tried to change the line in sorl-thumbnail to THUMBNAIL_STORAGE = settings.STORAGES["default"]
, and then many tests fail with error messages such as "You can't use this format for your profile picture. Only JPEG or PNG formats are accepted.". My conclusion is that settings.DEFAULT_FILE_STORAGE
is not the same as settings.STORAGES["default"]
in Django 4.2 alpha, and it looks like a bug. Or is it a feature?
Change History (3)
follow-up: 2 comment:1 by , 22 months ago
Component: | Uncategorized → File uploads/storage |
---|---|
Resolution: | → invalid |
Status: | new → closed |
follow-up: 3 comment:2 by , 22 months ago
Replying to Mariusz Felisiak:
I tried to change the line in sorl-thumbnail to
THUMBNAIL_STORAGE = settings.STORAGES["default"]
, and then many tests fail ...
STORAGES["default"]
is a dictionary not a class name so you should useTHUMBNAIL_STORAGE = settings.STORAGES["default"]["BACKEND"]
instead, see docs.
It is written on https://docs.djangoproject.com/en/dev/releases/4.2/ :
The DEFAULT_FILE_STORAGE
setting is deprecated in favor of STORAGES["default"]
.
You should write there how to convert from settings.DEFAULT_FILE_STORAGE
to settings.STORAGES["default"]["BACKEND"]
comment:3 by , 22 months ago
Replying to אורי:
It is written on https://docs.djangoproject.com/en/dev/releases/4.2/ :
TheDEFAULT_FILE_STORAGE
setting is deprecated in favor ofSTORAGES["default"]
.
You should write there how to convert fromsettings.DEFAULT_FILE_STORAGE
tosettings.STORAGES["default"]["BACKEND"]
It's deprecated in favor of STORAGES["default"]
as it's more flexible and gives more options. I don't see anything incorrect in this sentence. It's not written as "... use STORAGES["default"]
instead".
STORAGES["default"]
is a dictionary not a class name so you should useTHUMBNAIL_STORAGE = settings.STORAGES["default"]["BACKEND"]
instead, see docs.