[Fixed]-Django + S3 (boto) + Sorl Thumbnail: Suggestions for optimisation

7👍

sorl thumbnail is now created with remote slow storages in mind. The first creation of the thumbnail is however done quering the storage, for example first accessed from template, but after that the references are cached in a key value store. Still you need the first query and creation, well one solution is to use the low level api sorl.thumbnail.get_thumbnail with the same options when the image is uploaded. When the image uploaded add this thumbnail creation job to a que like celery.

👤sorl

3👍

You can use Sorlery. It combines sorl and celery to create thumbnails via workers. It’s very careful not to do any filesystem access outside of the worker thread.

The thumbnail returned immediately (before the worker has had a chance) can be controlled by setting your THUMBNAIL_DUMMY_SOURCE to an appropriate placeholder.

The job is created the first time the thumbnail is requested, subsequent requests are served the dummy image until the worker thread completes.

👤Aidan

1👍

Almost same as @Aidan’s solution, I have made some tweaks on sorl-thumbnail. I also pre-generate thumbnails with celery. My code is here sorl_thumbnail-async

But I came to know easy_thumbnails does exactly what I was trying to do, so I am using it in my current project. You might find useful, short post on the topic is here

1👍

The easiest solution I’ve found so far is actually this third party service: http://cloudinary.com/

👤Aidan

Leave a comment