kp_static_version is a simple Django app to add a version number to static files and force browsers to use the latest version of the file.
Project description
kp_static_version is a simple Django app to add a version number to static files and force browsers to use the latest version of the file.
Quick start
Install django-kp-static-version:
pip install django-kp-static-version
Add “kp_static_version” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'kp_static_version', ]Load templatetags into your template:
{% load kp_static %}Load your static file:
<script src="{% vstatic "js/sample.js" %}"></script>
If in your settings.py the variable DEBUG = True then a random number will be generated for development otherwise the value KP_STATIC_VERSION will be used:
KP_STATIC_VERSION = "0.5"
The result:
<script src="/static/js/sample.js?v=0.5"></script>
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 django-kp-static-version-0.2.tar.gz.
File metadata
- Download URL: django-kp-static-version-0.2.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a42998d81b67deb54fdd39f0e2111f3ccb751c81d5e8a733c1443400543e60cf
|
|
| MD5 |
cffe7a69b996ae3c071840e6af0bef75
|
|
| BLAKE2b-256 |
1f41314960a8e1132e0e7bc0d56f0ab4098bd043c96de7594399a2b8b0ab1540
|