Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset sorl Thumbnail for a Django site

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.

like image 498
Johndt Avatar asked Jun 30 '14 20:06

Johndt


1 Answers

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 %}
like image 86
Carlos Ortegon Avatar answered Oct 05 '22 22:10

Carlos Ortegon