Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Flask-CacheBuster is a lightweight Flask extension that adds a hash to the URL query parameters of each static file.

Project Description


Flask-CacheBuster is a lightweight extension that adds a hash to the URL query parameters of each static file. This lets you safely declare your static resources as indefinitely cacheable because they automatically get new URLs when their contents change.


Inspired by, and an updated version of to work with python 3.+


Using pip:

pip install flask-cachebuster



from flask_cachebuster import CacheBuster

config = { 'extensions': ['.js', '.css', '.csv'], 'hash_size': 5 }

cache_buster = CacheBuster(config=config)




* extensions - file extensions to bust
* hash_size - looks something like this `/static/index.css%3Fq3` where [%3Fq3] is the hash size.

The function will now cache-bust your static files. For example, this template:

<script src="{{ url_for('static', filename='js/main.js') }}"></script>

will render like this:

<script src="/static/js/main.js?%3Fq%3Dc5b5b2fa19"></script>

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask-CacheBuster-1.0.0.tar.gz (3.1 kB) Copy SHA256 hash SHA256 Source None Apr 17, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page