Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

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.

Files for django-kp-static-version, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size django-kp-static-version-0.2.tar.gz (14.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page