python - Django Easy Thumbnail not working -


I am using the easiest thumbnails in a project, and I follow the instructions in step. But I have come to know that the URL has not come back.

Model containing imageField:

  class project (models.Model): name = models.CharField (max_length = 100) Description = Model.Carfield (max_length = 2000) StartDate = models.DateField (auto_now_add = True) photo = models.ImageField (upload_to = "projectimg /", null = true, empty = true)  

and in the settings, I specify :

  THUMBNAIL_ALIASES = {'': {'avatar': {'size': (50, 50), 'crop': true},}}}  

and I use the template filter:

  & lt; Div class = "image" & gt; & Lt; Img src = "{{MEDIA_URL}} {{project.photo | thumbnail_url: 'avatar'}}" class = "img-responsive" alt = "{{project.name}}" & gt; & Lt; / Div & gt;  

However, the filter does not look back at anything. Is it because the URL is not found? Or for other reasons? Thanks for your time!

The problem can be one of two things, either in the user's directory running below your wsgi app There are no rights permissions, where the thumbnails are generated (most likely), or the pillow is not properly installed with the correct support.

In my case the user was checking to fix permissions, ran under Gonikola, I checked the Konkor Konf file and user = www-data which was 33, then I changed that directory. Given where the thumbnail was stored, top one directory and user ID 33 owner:

<<>

Restart your application now.

The other less likely problem pillow is not the right image support.

1) Install Old Installation

  sudo pip uninstall pillow  

2) Install all the necessary libraries (Ubuntu)

  sudo apt-get install libtiff4-dev libjpeg8-dev zlib1 G-dev \ libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk  

(Centos)

  Sudo yum install python-devel sudo yum install libjpeg-devel # so .. sudo yum install gcc gcc-c ++ sudo yum install zlib- Devel  

and reinstall the pillow

  sudo pip install pillow  

Check that you now have the right Support and restart your app server.


Comments