I can't get the thumbnail displayed in my template. I get this error:
django.db.utils.ProgrammingError: (1146, "Table 'ia_website.thumbnail_kvstore' doesn't exist")
Here is what I did
In settings.py:
INSTALLED_APPS = [
...
'sorl.thumbnail',
]
THUMBNAIL_DEBUG = TRUE
In models.py
import sorl
...
image = sorl.thumbnail.ImageField(upload_to='thumbnails', null=True)
In my template
{% thumbnail content.image "237x110" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
If just
manage.py makemigrations
doesn't create any migrations, try
manage.py makemigrations thumbnail
manage.py migrate
This will create migrations for thumbnail and then migrate them. It works for me. I am using Django 1.9 and sorl.thumbnail 12.3.
So after some research, it looks like the version 12.3
of sorl-thumbnail on PyPI and Github are different!
If you download the source directly from PyPI - you will find that the package doesn't contain any migrations. This is the reason the table doesn't exist even though you've run all the migrations.
On Github, the migration file for version 12.3
definitely exists.
You have three options:
./manage.py syncdb
(only if you're running Django 1.8 or below)12.3
12.4a1
of sorl-thumbnail which includes migrationsYou can install from Github directly as follows:
pip install git+git://github.com/mariocesar/[email protected]
sorl-thumbnail version 12.3 supports up to Django version 1.8, where the syncdb command still exists. If you're running Django 1.8 or lower, you can create the missing table by running
python manage.py syncdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With