Skip to main content

Django's application to serve up-to-date common static files (JQuery, Bootstrap, Plugins, ...) as "base" static directory

Project description

django-static-base PyPi license

PyPi status PyPi version PyPi python version PyPi downloads PyPi downloads PyPi downloads

GitHub GitHub release GitHub release

Test codecov.io pre-commit.ci status gitthub.com

Check Demo Project

  • Check the demo repo on GitHub

Requirements

  • Python 3.8+ supported.
  • Django 3.2+ supported.

Setup

  1. Install from pip:

    pip install django-static-base
    
  2. Add 'static_base' to your INSTALLED_APPS setting.

    INSTALLED_APPS = [
        # ...other apps
        "static_base"
    ]
    
  3. Add the following pre-requisites to your base.html template

    <html>
    <head>
    ...
      <link rel="stylesheet" type="text/css" href="{% static 'base/css/bootstrap.css' %}">
    ...
    </head>
    <body>
    ...
      <script type="text/javascript" src="{% static 'base/js/jquery.min.js' %}"></script>
      <script type="text/javascript" src="{% static 'base/js/bootstrap.min.js' %}"></script>
      <script type="text/javascript" src="{% static 'base/js/plugins/lazysizes.min.js' %}" async></script>
    ...
      <script type="module" src="{% static 'base/js/plugins/instantpage.min.js' %}" defer></script>
    </body>
    </html>
    
  4. Add all your needed plugins or customization to your base.html template or sub-templates used by your project

    <html>
    <head>
    ...
      <link rel="stylesheet" type="text/css" href="{% static 'base/css/plugins/jquery.smartmenus.bootstrap-4.css' %}">
    ...
      <link rel="stylesheet" type="text/css" href="{% static 'base/css/style-btn.css' %}">
      <link rel="stylesheet" type="text/css" href="{% static 'base/css/color/blue.css' %}">
    ...
      <link rel="stylesheet" type="text/css" href="{% static 'base/css/custom.css' %}">
    ...
    </head>
    <body>
    ...
      <script type="text/javascript" src="{% static 'base/js/jquery.min.js' %}"></script>
      <script type="text/javascript" src="{% static 'base/js/bootstrap.min.js' %}"></script>
    ...
      <script type="module" src="{% static 'base/js/plugins/instantpage.min.js' %}" defer></script>
    </body>
    </html>
    

Run Example Project

git clone --depth=50 --branch=django-static-base https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver

Now browser the app @ http://127.0.0.1:8000

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-static-base-0.1.2.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_static_base-0.1.2-py2.py3-none-any.whl (5.5 MB view details)

Uploaded Python 2Python 3

File details

Details for the file django-static-base-0.1.2.tar.gz.

File metadata

  • Download URL: django-static-base-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for django-static-base-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1fbf78ae0e3c4f89a3d643a45b1d7a59c93182063dcf7c98dcb7c1bd702638d4
MD5 66080ed6e5c6b60859acdb3109a53b89
BLAKE2b-256 8f694bd7fd92e5afd02c26ee8b5f15e38993c0b697c1419f567d50bc6c861cbb

See more details on using hashes here.

File details

Details for the file django_static_base-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_static_base-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 38000a9af9a0d293a33bda563410195a3dfcbb46f6ff04be70fb24371ed53060
MD5 021f418a8d62ca0210e0a2e0501c9baa
BLAKE2b-256 0b4c81fb198d0bd1c9a99d43edfa09f139636b5f9bd73f963ca00d95cfb3c030

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