Open bingosabi opened 6 years ago
This looks similar to this one #339. Actually not only with ImageKit if you have missing files and you try to get URL for them in templates it will crash in front of you. I know that is very bad user experience when for some missing file on the page the whole page is gone and you see 500 response.
We need to investigate it further to see how to improve the UX. If you have time and you are willing to came up with a PR I will be very glad.
I have a page which displays ~300 thumbnails using the ImageKit thumbnail template tag, but when a single file is not found then the entire page explodes. I encounter this when moving a database from prod to development for testing before I deploy if I don't move all of the accompanying source images and their generated thumbnails.
The Django Template guidelines suggest that tags should err gracefully, as any exception which is raised / not captured will cause such a server error:
IMO, this is low priority as there is a workaround (Ensure that database file values link to valid files on disk), but thought I'd at least open an issue as the template tag doesn't adhere to the Django guideline. (It's not a template bug... it's a data issue.)