After activating the debug on sorl.thumbnail
I got this error
Error importing module thumbnails.models: "No module named thumbnails.models"
and looking down on line 38 for the error callback I found this:
36 {% for article in object_list %}
37 <img src="{{article.photo.url}}" width="100px" >
38 {% thumbnail article.photo "100x100" as im %}**
39 <img src="{{ im.url }}" >
40 {% empty %}
41 <p>Thumbnail : No image</p>
I'm using the main database as cache with the following settings:
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'app',
'USER': 'root',
'PASSWORD': 'root',
'PORT': '',
}
}
.
.
.
.
CACHE_BACKEND = 'db://thumbnail_cache'
THUMBNAIL_QUALITY = 90
THUMBNAIL_PREFIX = 'images/'
THUMBNAIL_BACKEND = 'thumbnails.models.SEOThumbnailBackend'
THUMBNAIL_DEBUG = True
THUMBNAIL_KVSTORE = 'sorl.thumbnail.kvstores.cached_db_kvstore.KVStore'
THUMBNAIL_CACHE_TIMEOUT = 3600 * 24 * 365
THUMBNAIL_ENGINE = 'sorl.thumbnail.engines.pil_engine.Engine'
models.py
from sorl.thumbnail import ImageField
class Foto(models.Model):
user = models.ForeignKey('app.User', blank=True, null=False)
date = models.DateTimeField(auto_now_add=True)
photo = ImageField(upload_to='%Y/%m/%d', null=True, blank=True)