[Django]-How to make a thumbnail of a static image using sorl-thumbnail

3👍

sorl-thumbnail used storage functionality. Django delegates decisions about how and where to store files to a file storage system. This is the object that actually understands things like file systems, opening and reading files, etc. Django ships with a django.core.files.storage.FileSystemStorage class which implements basic local filesystem file storage. By default, Django stores files locally, using the MEDIA_ROOT and MEDIA_URL settings.

So in your case django try find image under MEDIA_ROOT, but you have saved the image under STATIC_ROOT.

How fix that

As hotfix you can try move image under MEDIA_ROOT and will change path in get_avatar method.
Or you can try write custom storage, which will work with both folders. Example custom storage.

Leave a comment