Django custom storage for Thumbor backend.
Project description
A Django custom storage for Thumbor backend.
Important: This package is still under development and should be used with care. Contributions are welcome!
This app provide 2 classes ThumborStorage and ThumborMigrationStorage. The last one is a storage you can use for Imagefield initialy using a FileSystemStorage you want to migrate to Thumbor without batch-moving all of them. That way, Django continues to serve them from the file system until you change the image on that field.
Install
pip install django-thumborstorage
Dependencies
Python 2.6 or 2.7
Django-1.5.x
Recommended:
Django-thumbor (to manage thumbnails).
Usage
settings.py
Add django-thumborstorage in your INSTALLED_APPS.
And set the following:
THUMBOR_SERVER = 'http://localhost:8888' THUMBOR_WRITABLE_SERVER = THUMBOR_SERVER THUMBOR_SECURITY_KEY = 'MY_SECURE_KEY'
THUMBOR_WRITABLE_SERVER exists because in some configurations you write on one server and read on another.
models.py
Just set the storage parameter in the ImageField you want to manage with Thumbor:
from django_thumborstorage.storages import ThumborStorage class Stuff(models.Model): def upload_path(instance, filename): return 'stuffs/%s' % filename photo = models.ImageField(upload_to=upload_path, storage=ThumborStorage(), height_field='photo_height', width_field='photo_width') photo_height = models.IntegerField(blank=True, null=True) photo_width = models.IntegerField(blank=True, null=True)
TODO
PUT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-thumborstorage-0.91.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03cf527fd8adb5695c026dbf7f9e79952c6fe371f05d407b4dcd5e97f695e06c |
|
MD5 | ccc493b71d6e3c6a1090fc34a827434d |
|
BLAKE2b-256 | 9ad0e75d989f683e470f64b0ceaea5dd8ca9052bdfbe316d2c13366b32735e8f |