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>
Release files for django-kp-static-version 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-kp-static-version-0.2.tar.gz | 14.4 kB | Details |
Release files / django-kp-static-version-0.2.tar.gz
| Download URL | django-kp-static-version-0.2.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a42998d81b67deb54fdd39f0e2111f3ccb751c81d5e8a733c1443400543e60cf
|
|
BLAKE2b-256 checksum How to use checksums |
1f41314960a8e1132e0e7bc0d56f0ab4098bd043c96de7594399a2b8b0ab1540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|