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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file Flask-Autoversion-0.2.0.tar.gz
.
File metadata
- Download URL: Flask-Autoversion-0.2.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d02b67107efabcfc33ac61260d77a674c1d8b1233264b5d4c9cc34d8dae74ed1 |
|
MD5 | 0fc5cf834ab03a36d34060466f88a0b8 |
|
BLAKE2b-256 | edc97bc73eb0ef83eaf82d3fca1ae2c6f75c32b4ef390b5d69eeaca3804c1716 |