Skip to content
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

cachefile_storage accept callable which returns a storage object #525

Closed
pickfire opened this issue Jul 15, 2021 · 3 comments · Fixed by #526
Closed

cachefile_storage accept callable which returns a storage object #525

pickfire opened this issue Jul 15, 2021 · 3 comments · Fixed by #526

Comments

@pickfire
Copy link
Contributor

A storage object, or a callable which returns a storage object. This handles the storage and retrieval of your files. See Managing files for details on how to provide this object.

But imagekit only accepts a storage object. It should supports a callable which returns a storage object for feature parity with django.

So rather than doing cachefile_storage=S3Boto3Storage(), one can just do cachefile_storage=S3Boto3Storage.

storage = storage or getattr(generator, 'cachefile_storage',
None) or get_singleton(settings.IMAGEKIT_DEFAULT_FILE_STORAGE,
'file storage backend')

@vstoykov
Copy link
Collaborator

Thank you for reporting the issue. Do you think that you can be able to prepare a PR with a fix for that?

pickfire added a commit to pickfire/django-imagekit that referenced this issue Jul 16, 2021
@bodgerbarnett
Copy link

I've just been trying to use this fix and it looks like the change makes the storage callable - not the cachefile_storage. Or have I misunderstood something here?

@pickfire
Copy link
Contributor Author

Yeah, looks like it, I noticed it in our project too but I didn't submit a pull request, supposedly it should also check if cachefile_storage is callable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants