Reputation: 83
I'm trying to upgrade a django project using the old sorl-thumbnail (v.3.2.5) to the newest (v.12.0) but I'm not able to get it generate placeholder images in development environment using the settings provided: http://sorl-thumbnail.readthedocs.org/en/latest/reference/settings.html#thumbnail-dummy
Here are my settings:
THUMBNAIL_DEBUG = True
THUMBNAIL_DUMMY = True
THUMBNAIL_DUMMY_SOURCE = 'http://placekitten.com/%(width)s/%(height)s'
MEDIA_URL = '/media/'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
This is the model using sorl ImageField:
from sorl.thumbnail import ImageField
class Cover(models.Model):
[... other fields here]
image = ImageField("immagine", upload_to='images/cover/%Y/%m/%d', max_length=255)
and the admin inherits from sorl.thumbnail.admin.AdminImageMixin. The project uses Django 1.6 but I tried same settings on another project which uses Django 1.5.5 and I have the same problem.
Thumbnails are correctly generated (and retrieved from cache) for newly updated images, but pre-existent images are not substituted with placeholders, neither in admin nor in frontend pages (development server answers with a 404).
Any clues? Sorl docs are really scarce...
Upvotes: 1
Views: 354
Reputation: 83
After searching through sorl-thumbnail code I found out that in the admin the THUMBNAIL_DUMMY setting is not even considered... There is a pull request to solve this (opened a year ago): https://github.com/mariocesar/sorl-thumbnail/pull/128
As for the frontend it works, it was just a silly mistake in the template.
Upvotes: 2