django-webpack-loader
Transparently use webpack with django
What it is and what it does
Django Webpack Loader bridges Webpack and Django by consuming a stats file (webpack-stats.json) generated by webpack-bundle-tracker and exposing a template tag to render compiled bundles. It reads bundle metadata at runtime and injects the correct script and link tags into Django templates, handling asset paths and caching based on the DEBUG setting.
The package has no runtime dependencies and integrates directly into Django's template system. During development, it polls the stats file frequently to reflect live changes; in production, it caches the file once to minimize I/O. Configuration is done via Django settings, specifying the stats file location, bundle directory, and optional regex patterns to exclude certain assets.
Use it for:
- Render CSS and JavaScript bundles compiled by Webpack into Django templates using a single template tag.
- Develop Django projects with hot-reloading frontend assets by polling the stats file during development.
- Cache bundle paths in production to avoid repeated stats file reads while serving pre-compiled assets.
- Exclude specific generated files (e.g., source maps, hot-update files) from template rendering via regex patterns.
- Integrate multiple Webpack entry points into different parts of a Django template for code splitting.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Webpack-compiled bundles into Django templates via a simple template tag that reads a stats file generated by webpack-bundle-tracker.
Yes. The package is actively maintained, has no runtime dependencies, supports current Django and Python versions, carries a permissive MIT license, and solves a common pain point in Django–Webpack integration. Install it if you are using Webpack to compile frontend assets for a Django project.
Install
django-webpack-loader on PyPI
pip
pip install django-webpack-loaderuv
uv add django-webpack-loaderpoetry
poetry add django-webpack-loaderInstalling django-webpack-loader
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent releases; supports modern Django (4.2–5.2) and Python (3.8–3.13) versions.
License in practice
MIT License permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
# Install
pip install django-webpack-loader
# In Django settings.py
INSTALLED_APPS = [
...
'webpack_loader',
]
WEBPACK_LOADER = {
'DEFAULT': {
'STATS_FILE': '/path/to/webpack-stats.json',
}
}
# In a Django template
{% load render_bundle from webpack_loader %}
{% render_bundle 'main' 'css' %}
webpack-bundle-tracker must be configured in your Webpack build to generate the stats file before django-webpack-loader can read it.
Verify before relying
- Whether the package works with Webpack versions other than Webpack 5 (documentation mentions examples in Webpack 5 but does not explicitly state version compatibility).
- Whether hot-reload functionality is production-ready or development-only (documentation references a 'specific config' but details are not included in the excerpt).
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 93 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 969,888/month — #4,611 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_webpack_loader-3.2.4-py2.py3-none-any.whl
Keywords: django, webpack, assets
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
django-navhelperProvides Django template tags to automatically…
permissive · top 15,000 on PyPI
django-pipelinedjango-pipeline bundles and compresses CSS and…
permissive · top 15,000 on PyPI
django-componentsdjango-components lets you build reusable,…
permissive · top 15,000 on PyPI
django-tailwindIntegrates Tailwind CSS into Django projects…
permissive · top 15,000 on PyPI
django-sass-processorCompiles SASS/SCSS files to CSS on the fly…
permissive · top 15,000 on PyPI
django-viteIntegrates Vite, a modern JavaScript build…
permissive · top 5,000 on PyPI
django-jinjaIntegrates Jinja2 templating into Django,…
permissive · top 15,000 on PyPI
django-template-partialsProvides reusable named template partials for…
permissive · top 15,000 on PyPI
Flask-AssetsIntegrates asset management into Flask…
permissive · top 15,000 on PyPI
django-js-assetAdds script, stylesheet, and JSON tags with…
permissive · top 5,000 on PyPI