Reset sorl Thumbnail for a Django site
Asked Answered
D

1

8

We switched from a development server to a production server, but attempted to use the same cache for sorl thubmnail. In our attempt to resolve issues, we pretty much messed up the cache, deleting all cached images.

Sorl thinks that it has found a thumbnail, but no thumbnail exists, so an error image is displayed. An attempt to directly access the thumbnail image from its URL results in a 404.

What I would like to do is reset sorl, as if I were first starting to use it. I have attempted to run python manage.py thumbnail cleanup and python manage.py thumbnail clear, however sorl will still return a url such as "http://www.whatever.com/media/cache/84/0f/840fa03745a82238b980f4ceb188b110.jpg", where no image exists.

I thought that the point of sorl was to look for a thumbnail, and if one does not exists, it creates one.

I have even tried dropping the thumbnail_kvstore table from my database, and it changed nothing. I tried changing the THUMBNAIL_KVSTORE setting to Redis, and it also changed nothing. Sorl still keeps returning thumbnails that don't exist.

I can create new thumbnails, and these thumbnails then work correctly.

How do I reset sorl completely in my Django project, so that when it goes through my site, it will generate thumbnails again?

Thank you for your help

EDIT: I have looked into it a little bit more, and I think the problem may be related to creating thumbnails in the production environment. On my development server, I run thumbnail clear, and the site then reloads thumbnails. My production server is run using ngin-x and uWSGI, and DEBUG is off.

LATE EDIT: My problem was a permissions one. The production server did not have permission to write to the drive containing the cache, whereas the development server did.

Durfee answered 30/6, 2014 at 20:45 Comment(4)
did you solve the issue?Mara
@Brian Yes, I solved the issue we were having; however, I don't think we did so by resetting sorl. As stated in the "LATE EDIT" to the question, the problem was quite unrelated. That's why I didn't post it as an answer.Durfee
Create a response explaining how you solved this. I am having the same problem with AWS. Do I have to change AWS_DEFAULT_ACL or something that I have to change in S3 itself?Lentamente
Hi @GuilhermeIA - Please see my "LATE EDIT" in the question - my problem was quite unrelated to sorl thumbnail. You might consider opening a separate question with the specifics of your issue and setup.Durfee
I
2

The same thing happened to me, what I did was to change the size of the image so it can reload them again:

{% thumbnail image.original "x301" as thumb %}
Incarnate answered 19/12, 2016 at 19:5 Comment(1)
This is not the right answer, it is a gambiarra. You can update, but every time he has to update will he have to change the cut size?Lentamente

© 2022 - 2024 — McMap. All rights reserved.