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.

Installation

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
Autoversion(app)

@app.route('/')
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.

Files for Flask-Autoversion, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size Flask-Autoversion-0.2.0.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page