Django tries to serve cached image that does not exist

206 Views Asked by At

I'm running django 1.7.1

I'm trying to render a .html page that makes used of some cached images.

This is the Image model that these images belong too:

image_pbox = models.ImageField(                                                                                                                                                                                                                                                               
     upload_to='pbox', blank=True, max_length=255, storage=STORAGE, null=True)
                                                                                                                                                                                                                                                                                          
image_pbox_300 = ImageSpecField(
    [ResizeToFit(300, 300)],                                                                                                                                                                                                                                                                  
    source='image_pbox', format='JPEG', options={'quality': 90},
    cachefile_storage=STORAGE)

On the webpage, I can use pagintaion to select different sets of Image instances to return, and eventually they are rendered using:

{{image.image_pbox_300.url}}

Now, initially this all worked fine. Then, my server had a power issue and the drive on which these cached images were located was temporarily disconnected. Now, I can use my web page to render some cached images - I'm assuming those that have not been cached before, but this is a guess. Other images - ones that I am sure off were cached before - return a permission error. Remember that this are just different instances of the same model. E.g. the first few images return an error, the later ones don't.

The permission error:

OSError at /make_data_request/
[Errno 13] Permission denied: '/data/gallery/config/media/CACHE/images/pbox/MVSrCYHsteI6D0ocQfiLwwy'

The permission error seems straightforward. Must be something with ..permissions, right? Everything related to permissions seems to be configured properly - and remember, a selection of images does work. Every image located within /data/gallery/config/media/CACHE/images/pbox/ has the same permissions.

I noticed however, that the specific image raising the error doesn't even exist.. (ls -la | grep MVS returns empty in the directory).

What should I do now?

I tried to simply run cache.clear() but that didn't do anything.

0

There are 0 best solutions below