I am currently developing on a UWSGI/NGINX server running on Ubuntu Linux 16.04. This is nearly the exact setup that we have on the server (it is 18.04). We're using Wagtail 2.4 and Python 3.6 in both environments. I have deployed a site and copied over all images from the media folder (from both the /media/images and the media/original_images folder). On the dev server I could edit every image just fine, and everything is working correctly on the production server (both with the site and with the admin) except that, on a handful of the images, when I'm in the admin and click on one of these to view/edit, these few generate an error. They are not in any particular collection and are of different types (jpg, png). The error that is generated is:
[Errno 13] Permission denied:
/sites/site_name/media/images/image_name.original.jpg
Following the flow from uploading an image in the Wagtail admin to then editing it, I see that, when images are first uploaded, three renditions are created in /media/images:
- xxxxxx.max-165x165.xxx
- xxxxxx.width-450.xxx
- xxxxxx.width-1440.xxx
Then, when an image is clicked on in order to edit it, the xxxxxx.original.xxx version is placed in /media/images. On the dev server, I had not clicked on this handful of images to edit them and so the xxxxxx.original.xxx version had not been placed in /media/images. Therefore, I did this and then uploaded these .original versions to the production server to, I thought, fix the above error. However, now when I click on an image to edit it, I get the same error except it's now looking for an original with a randomly generated string as part of the name:
[Errno 13] Permission denied:
/sites/site_name/media/images/image_name.original_RANDOM-STRING.jpg
Each of the original images IS in the /media/original_images folder, so I actually would have thought that it would pull from there OK and create the xxxxxxx.original.xxx version in /media/images when trying to edit. But why, then, doesn't placing the xxxxxx.original.xxx version in the /media/images folder fix this error and why does it then look for a version with a randomly generated string instead of simply finding the xxxxxx.original.xxx version?