Skip to main content

Integrate django with bower

Project description

Easy way to use bower with your django project.

Bower is a package manager for the web. It offers a generic, unopinionated solution to the problem of front-end package management, while exposing the package dependency model via an API that can be consumed by a more opinionated build stack. There are no system wide dependencies, no dependencies are shared between different apps, and the dependency tree is flat.

Read full documentation on read-the-docs.

Installation

Install django-bower package:

pip install django-bower

Add django-bower to INSTALLED_APPS in your settings:

'djangobower',

Add staticfinder to STATICFILES_FINDERS:

'djangobower.finders.BowerFinder',

Specifie path to components root (you need to use absolute path):

BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/components/'

If you need, you can manually set path to bower

BOWER_PATH = '/usr/bin/bower'

You can see example settings file in example project.

Usage

Specifie BOWER_INSTALLED_APPS in settings, like:

BOWER_INSTALLED_APPS = (
    'jquery#1.9',
    'underscore',
)

Download bower packages with management command:

./manage.py bower_install

Add scripts in template, like:

{% load static %}
<script type="text/javascript" src='{% static 'jquery/jquery.js' %}'></script>

In production you need to call bower_install before collectstatic:

./manage.py bower_install
./manage.py collectstatic

You can use bower_freeze to receive BOWER_INSTALLED_APPS with fixed current versions:

./manage.py bower_freeze

Python 3 support

django-bower support python 3.3+

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-bower-4.6.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file django-bower-4.6.tar.gz.

File metadata

  • Download URL: django-bower-4.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-bower-4.6.tar.gz
Algorithm Hash digest
SHA256 2c455505ce456c3182676b33ff5c579eda0001835c29fb5d2c1ded86fd3a0e39
MD5 58e3d79a5c81f14f60e0045b18be7fe1
BLAKE2b-256 bf6bc839bfea2b783826bf3b2d3a932bd4526b08e78a11b36d6aa81908daa168

See more details on using hashes here.

Supported by

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