-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #516: thumbnail_cleanup command for S3 and different source storages #562
Conversation
e5f2ff2
to
b8be258
Compare
Hi there. |
Is there a way to test this? |
b8be258
to
febbc41
Compare
@jrief Maybe at least some testing could be added. |
febbc41
to
aeea8ba
Compare
aeea8ba
to
e79558a
Compare
9481d2c
to
6b3a7e8
Compare
With introduction of Django 4.2+ storages, this problem is easier to solve. I have rewritten this, so that it autodetects the correct storage based on the For this reason the support of older Django versions needs to be dropped, but they out of support anyway. This PR contains commits from other PRs (#638, #635) which are meant to be merged first. I have improved tests for this new functionality. |
Thanks @PetrDlouhy , I just released version 2.9.0. |
I was able to make partial fix for #516.
It enables
thumbnail_cleanup
to work correctly with S3 stoarges and works with different source and destination storage.The default source storage is now set to
DEFAULT_FILE_STORAGE
(which is probably better choice in case when the source and destination storages differ), and can be changed by the management command--source-storage
parameter.It also adds check for the source storage hash, and if the hashes differ, it only prints warning, but take no action.
May be we could detect all possible storages and compare their hashes with the
source.storage_hash
value. But I am not sure, if I can load all storage options from settings. The situation would be much easier, if the storage classpath string is stored directly in theSource
objects.Also this change doesn't cover cases, when user wants to change the source storages. In such cases it might be useful either to change the source hash or to delete the thumbnail reference based on users requirements.