Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Django, how to get django-storages, boto and easy_thumbnail to work nicely?

I'm making a website where files are uploaded through the admin and this will then store them on Amazon S3. I'm using django-storages and boto for this, and it seems to be working just fine.

Thing is, I'm used to use my easy_thumbnails (the new sorl.thumbnail) on the template side to create thumbnails on the fly. I prefer this approach, rather than the model side, as it allows for easier maintenance if ever I decide to change the thumbnail size at a later date etc.

But I'm realising that easy_thumbnails doesn't seem to like reading the image now it's stored on Amazon S3. Also, I realised, where exactly would it be putting the thumbnails once made anyhow? Obviously, I'd prefer these to be on Amazon S3 as well. But how do I get these two technologies to play nice?

How would I get easy_thumbnails to store the thumb it creates back on Amazon S3? Or am I just looking at this all wrong?!

Thanks!

like image 871
littlejim84 Avatar asked Aug 03 '10 14:08

littlejim84


1 Answers

easy_thumbnails will do S3-based image thumbnailing for you - you just need to set settings.THUMBNAIL_DEFAULT_STORAGE, so that easy_thumbnails knows which storage to use (in your case, you probably want to set it to the same storage you're using for your ImageFields).

like image 118
girasquid Avatar answered Oct 18 '22 12:10

girasquid