matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

No such file or directory error #455

Closed joeydebreuk closed 6 years ago

joeydebreuk commented 6 years ago

Uploading large images, around 5+mb, gives me a 502 error in Django Admin. Nginx tells me its unable to open the file.

Someone familiar with this issue? How can I fix this?

I'm using Postgress, Gunicorn but this doesnt seem to have anything to do with it. Its running on a lightsale instance (AWS).

Versions:

Django==1.11.9
django-imagekit==4.0.2
Pillow==5.0.0

Nginx Errors:

2018/02/15 15:25:30 [error] 9532#9532: *2727 open() "/home/martijn/sunstudies-env/static/CACHE/images/image/NIU_2759_60_61_62_63_fused/e1f01586ba89638395c70565844891f2.jpg" failed (2: No such file or directory), client: 145.89.53.228, s$

2018/02/15 15:25:30 [error] 9532#9532: *2725 open() "/home/martijn/sunstudies-env/static/CACHE/images/image/Luzzu_Marsaxlokk/7e015267fb3f426a7e78f378a84d3885.jpg" failed (2: No such file or directory), client: 145.89.53.228, server: tes$

$/1.1", upstream: "http://127.0.0.1:8000/adminschools/schoolimage/add/", host: "test.sunstudies.nl", referrer: "https://test.sunstudies.nl/adminschools/schoolimage/add/"

Image Model:

class Image(models.Model):
    key = AutoSlugField(always_update=True, unique=True, populate_from='alt')
    title = models.CharField(max_length=35, blank=True, null=True)
    alt = models.CharField(max_length=120)
    description = models.CharField(max_length=255, blank=True, null=True)
    uploaded_at = models.DateTimeField(auto_now_add=True)
    large = ProcessedImageField(upload_to='image', processors=[ResizeToFit(1820, 1024, False)], format='JPEG', options={'quality': 70}, validators=[image_validator])
    medium = ImageSpecField(source='large', processors=[ResizeToFit(1024, 680, False)], format='JPEG', options={'quality': 70})
    small = ImageSpecField(source='large', processors=[ResizeToFit(270, 180, False)], format='JPEG', options={'quality': 70})
    tiny = ImageSpecField(source='large', processors=[ResizeToFit(45, 25, False)], format='JPEG', options={'quality': 20})

Nginx Settings:

server {

   ...

    #increase max file size to 20mb
    client_max_body_size 20M;
    proxy_read_timeout 300s;
    proxy_connect_timeout 75s;

        ...

    }

    ...

}
joeydebreuk commented 6 years ago

tbh I am not 100% sure this is a imagekit issue

joeydebreuk commented 6 years ago

I managed to get the same error without using django image-kit, so not related to this project.