flask-s3
flask-s3 copied to clipboard
Cache busting
Option that appends file hashes as query strings to static URLs. This forces a refetch if the content changes even if the expiry header has been set far into the future.
Webassets does this for scripts and stylesheets (http://webassets.readthedocs.org/en/latest/expiring.html) but there isn't anything that does it for images.
hey @andrewsnowden sorry for the delay in reviewing this (and the other) PR(s).
One concern I see here is when images are intentionally left out of the repository, uploaded to S3, from a single machine, and not necessarily on all production machines. We may actually want to do this initial reading and hashing from S3, and not locally.
Additionally, we may want to actually update the filename, so for example (very roughly)
url_for('static', 'foo.jpg')
> hashes['foo.jpg']
> s3.amazon.com/bucket/foo-3j4kjl.jpg
or if it hasn't been hashed yet,
url_for('static', 'foo.jpg')
> hash('foo.jpg')
> boto.upload('foo-slk43d.jpg')
> s3.amazon.com/bucket/foo-slk43d.jpg
any thoughts on this type of approach?