You are not applying the filter because |file_exists
is outside of {{}}
. Try this:
<img src="{{ STATIC_URL }}images/{{ book.imageurl|file_exists }}" alt="{{book.title}} Cover Photo">
Or, if you want to apply file_exists
to the whole image url, try this:
<img src="{{ STATIC_URL|add:'images/'|add:book.imageurl|file_exists }}" alt="{{book.title}} Cover Photo">