I have a high load django project with a lot of images in it (in django.db.models.ImageField). I'm looking for a solution with the following criteria:
I would be grateful for your help.
For (1) you should be able to use django-cumulus
, I'm not aware of another working package for Rackspace CloudFiles.
For (2) set the STATICFILES_STORAGE
setting to point to the class which handles static files on the cloud. In my case I store my user-uploaded static files on Amazon S3, and I extend the S3BotoStorage
class imported this way:
from storages.backends.s3boto import S3BotoStorage
from django-storages
. Find what the equivalent class is for the django-cumulus
module and use/extend accordingly; storage classes are in here. The key is to set STATICFILES_STORAGE
to point to it.
For (3) use your thumbnail generation library to "fetch" the image at the various thumbnail sizes you need when the source image changes. This will create them immediately (if they do not exist yet). (This applies for the libraries I have used, which are sorl-thumbnail
and easy_thumbnails
.
Side note: "asynchronous generation" of thumbnails (so that the initial request does not have to wait for all thumbnails to be generated immediately) is a popular requirement, and it is fairly documented for the easy_thumbnails
library here. Should be straightforward to set up if you have celery
already enabled in your architecture.