Skip to main content

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

  1. Install django-kp-static-version:

    pip install django-kp-static-version
  2. Add “kp_static_version” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'kp_static_version',
    ]
  3. Load templatetags into your template:

    {% load kp_static %}
  4. 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


Download files

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

Source Distribution

django-kp-static-version-0.2.tar.gz (14.4 kB view details)

Uploaded Source

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

Hashes for django-kp-static-version-0.2.tar.gz
Algorithm Hash digest
SHA256 a42998d81b67deb54fdd39f0e2111f3ccb751c81d5e8a733c1443400543e60cf
MD5 cffe7a69b996ae3c071840e6af0bef75
BLAKE2b-256 1f41314960a8e1132e0e7bc0d56f0ab4098bd043c96de7594399a2b8b0ab1540

See more details on using hashes here.

Supported by

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