Tuesday, March 3, 2020

NotImplementedError: This backend doesn't support absolute paths.

Hi Folks,

I'm using AWS S3 Bucket to store media folder(images) but I want to resize each every image in 300*300. So, I'm overriding the save method inside django model class. But I'm getting one error caled:
   NotImplementedError: This backend doesn't support absolute paths.

My django models look like:

 class Profile(models.Model):
    user = models.OneToOneField(
        AUTH_USER_MODEL,
        on_delete=models.CASCADE,
        related_name="profile"
    )
    profile_pic = models.ImageField(default = 'profile.jpg',upload_to = user_directory_path, null = True)

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        img = Image.open(self.profile_pic.path)
        if img.height > 300 or img.width > 300:
            output_size = (300, 300)
            img.thumbnail(output_size)
            img.save(self.image.path)




I don't know how to solve this issue.

Thank you in advance

Regards,
soumen

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WYJxPh%3DHY%2Bm0HLajTN1EV-9eo4djThgiCZdjdbaM2pr0A%40mail.gmail.com.

No comments:

Post a Comment