3๐
โ
Your code looks fine, so the problem should come from other parts.
The first thing you can do is to set THUMBNAIL_DEBUG = True
in your settings.py
and see why the error occurs.
Are you using virualenv
and PIL
for image library? Make sure your PIL
is compiled and installed with jpeg
and png/gif
support which requires libjpeg
and zlib
.
Edit: As @DanielRoseman pointed out in the comment, you are actually using django.db.models.ImageField
, changing
image = models.ImageField(upload_to="uploads")
to
image = ImageField(upload_to="uploads")
to use sorl.thumbnail.ImageField
instead.
๐คK Z
0๐
Try doing a cleanup, or if that fails, clear. Documentation
This resolved the problem for me when I was getting unexpected output. Maybe it will work for you.
๐คKeith
- [Django]-Python โ Splitting a string of names separated by spaces and commas
- [Django]-Posting complex data dictionary with request python
- [Django]-Installing a gem bundle in a python app on Heroku
Source:stackexchange.com