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',
Specify path to components root (you need to use an absolute path):
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/components/'
If you need, you can manually set the path to bower:
BOWER_PATH = '/usr/bin/bower'
You can see an example settings file in example project.
Usage
Specify BOWER_INSTALLED_APPS in settings, like:
BOWER_INSTALLED_APPS = (
'jquery#1.9',
'underscore',
)
Download bower packages with the management command:
./manage.py bower install
Add scripts in the template, like:
{% load static %}
<script type="text/javascript" src='{% static 'jquery/dist/jquery.js' %}'></script>
In production you need to call bower install before collectstatic:
./manage.py bower install
./manage.py collectstatic
If you need to pass arguments to bower, like –allow-root, use:
./manage.py bower install -- --allow-root
You can use bower freeze to receive BOWER_INSTALLED_APPS with fixed current versions:
./manage.py bower freeze
You can call bower commands like info and update with:
./manage.py bower info backbone
./manage.py bower update
Python 3 support
django-bower supports python 3.3+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-bower-5.1.0.tar.gz
.
File metadata
- Download URL: django-bower-5.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d064d07cae9585315f520bb53e048ebfbb3f1caf6fd9b454e7c518450689c90d |
|
MD5 | ddc1cc9cc93d5b57acfe3d17331dd3be |
|
BLAKE2b-256 | a7165e54391590310df7b362eedd1df0036259d561ca52b6413632702cae6e98 |
File details
Details for the file django_bower-5.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_bower-5.1.0-py3-none-any.whl
- Upload date:
- Size: 34.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c32b3c09a4075cf22f60bfd2e78fecf24efecf47ad909925bca1ef0a93456a18 |
|
MD5 | b4f4b25dd8b1e4a1917ca5b5fa5051f7 |
|
BLAKE2b-256 | ae1abda22fd9a582f5870500f4016b0098650dc5fdf901ee223ea88d109921df |