Skip to main content

Add query parameters to static file paths.

Project description

Flask Autoversion

Automatically version static file paths. When actively developing a web application, you may experience issues with browsers caching your static content. With this extension you can easily use the function in your templates that will update the query added on to the file path to bust the browser cache.


Install the extension:

pip install Flask-Autoversion

Set Up

A typical setup:

from flask import Flask, render_template
from flaskext.autoversion import Autoversion

app = Flask(__name__)
app.autoversion = True

def hello_world():
    return render_template("home.html")

Setting app.autoversion to True will append a query string with the file last-modified timestamp as the value.

Versioning Static Files in Jinja

<link rel="stylesheet" type="text/css" href="{{ static_autoversion('app.css') }}">

Project details

Download files

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

Source Distribution

Flask-Autoversion-0.2.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page