Resize thumbnails django Heroku, 'backend doesn't support absolute paths'
django, heroku, python-imaging-library
Solution
Working with Heroku and AWS, you just need to change the method of FileField/ImageField 'path' to 'name'. So in your case it would be:
image.save(self.project_thumbnail.name)
instead of
image.save(self.project_thumbnail.path)
Problem
I've got an app deployed on Heroku using Django, and so far it seems to be working but I'm having a problem uploading new thumbnails. I have installed Pillow to allow me to resize images when they're uploaded and save the resized thumbnail, not the original image. However, every time I upload, I get the following error: "This backend doesn't support absolute paths." When I reload the page, the new image is there, but it is not resized. I am using Amazon AWS to store the images. I'm suspecting it has something to do with my models.py. Here is my resize code: ``` class Projects(models.Model): project_thumbnail = models.FileField(upload_to=get_upload_file_name, null=True, blank=True) def __unicode__(self): return self.project_name def save(self): if not self.id and not self.project_description: return super(Projects, self).save() if self.project_thumbnail: image = Image.open(self.project_thumbnail) (width, height) = image.size image.thumbnail((200,200), Image.ANTIALIAS) image.save(self.project_thumbnail.path) ``` Is there something that I'm missing? Do I need to tell it something else?