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

Integrate django with yarnpkg

Project description

Easy way to use yarnpkg with your Django project.

This is a fork of django-bower <> by Vladimir Iakovlev.

Read full documentation on read-the-docs.


Install django-yarnpkg package:

pip install django-yarnpkg

Add django-bower to INSTALLED_APPS in your settings:


Add staticfinder to STATICFILES_FINDERS:


Specify path to components root (you need to use an absolute path):

NODE_MODULES_ROOT = os.path.join(BASE_DIR, 'node_modules')

If you need, you can manually set the path to yarnpkg:

YARN_PATH = '/usr/bin/yarnpkg'

You can see an example settings file in example project.


Specify YARN_INSTALLED_APPS in settings, like:


Download yarn packages with the management command:

./ yarn 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 yarnpkg install before collectstatic:

./ yarn install
./ collectstatic

If you need to pass arguments to yarnpkg, like –flat, use:

./ yarn install -- --flat

You can call yarnpkg commands like info and update with:

./ yarn info backbone
./ yarn update

Python 3 support

django-yarnpkg supports 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.

Files for django-yarnpkg, version 6.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-yarnpkg-6.0.1.tar.gz (7.1 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