I got Fanstatic working well with Flask for CSS and JS. The library will allow you to generate hashed file names with a hash. If the hash of click.js is a0sd2lfu12v18fhac4ias0o7if then you can render click-a0sd2lfu12v18fhac4ias0o7if.js in your flask application. The purpose of this is to invalidate browser and CDN cache. When the contents of the file change, so does the name of the file.
I need a library that generates hashes for my images like Fanstatic does for CSS/JS so that when I update my images and deploy to production the browser uses the new image.
The docs for Fanstatic mention it can serve images but it doesn't give any examples. How can I get this hash based file name with my image assets using Flask? If you know how to do this with fanstatic can you please tell me how? If there is a better library to render images with hash based filenames, could you point me in the right direction?
Assuming you have set up the fanstatic Publisher, here's how to compute the URL to resource
quxduring a request cycle: