django-js-reverse
Javascript url handling for Django that doesn't hurt.
What it is and what it does
Django JS Reverse is a Django app that bridges the gap between backend URL routing and frontend JavaScript by making named URLs available as callable functions in the browser. Instead of hardcoding URL paths in JavaScript or maintaining a separate URL mapping, you define routes once in Django's urlpatterns and access them from JavaScript using the same names—the package generates a JavaScript object that mirrors your URL configuration and handles parameter substitution.
The package supports multiple integration patterns: as a static file generated via management command, as a JSON endpoint for webpack/bundlers, as a view that serves JavaScript directly, or as an inline template tag. It handles URL namespaces, parameter conversion, and can be configured to include or exclude specific namespaces, minify output, and work with application subpaths.
Use it for:
- Single-page applications that need to construct API or page URLs dynamically without duplicating route definitions.
- Django templates with embedded JavaScript that reference named URLs, avoiding hardcoded path strings.
- Webpack-bundled frontends that fetch URL mappings at runtime and use them for client-side routing or API calls.
- Projects with complex URL hierarchies using namespaces, where maintaining parallel URL lists in frontend code becomes error-prone.
- Content Security Policy–compliant applications that cannot use inline JavaScript and need to load URL mappings from a separate endpoint.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Exposes Django named URLs to JavaScript, allowing frontend code to generate URL paths using the same route definitions as the backend without hardcoding strings.
Yes. The package solves a genuine Django development friction point—keeping frontend and backend URL definitions in sync—with low install overhead, active maintenance, no known vulnerabilities, and permissive licensing. It is most valuable in projects with dynamic or complex URL structures where hardcoding paths in JavaScript creates maintenance burden.
Install
django-js-reverse on PyPI
pip
pip install django-js-reverseuv
uv add django-js-reversepoetry
poetry add django-js-reverseInstalling django-js-reverse
Before you install
Low friction installation with a single runtime dependency on Django. Actively maintained as of May 2026 with recent support for Django 5.2 LTS and 6.0, and current Python versions 3.10–3.14.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects without licensing concerns.
Quickstart
pip install django-js-reverse
# In settings.py
INSTALLED_APPS = [
...,
'django_js_reverse',
]
# In urls.py
from django_js_reverse.views import urls_js
urlpatterns = [path('jsreverse/', urls_js, name='js_reverse')]
# In JavaScript
// After including the generated script
Urls.betterlivingGetHouse('house', 12) // => '/betterliving/house/12/'
Requires Django to be installed and configured; requires Python 3.10 or later.
Verify before relying
- Whether the package handles all Django URL parameter types (path converters, regex patterns) correctly in JavaScript generation.
- Performance impact when dealing with large URL configurations or frequent URL reversals in JavaScript.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Django |
| Maintenance | actively maintained — 84 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 109,891/month — #12,495 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_js_reverse-1.0.0-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-statici18nCompiles Django's JavaScript…
permissive · top 15,000 on PyPI
django-reverse-adminAdds reverse inline support to Django admin for…
permissive · top 15,000 on PyPI
django-compressorDjango Compressor combines, minifies, and…
permissive · top 5,000 on PyPI
django-browser-reloadAutomatically reloads your browser when you…
permissive · top 15,000 on PyPI
django-icalGenerates iCalendar (iCal) feeds from Django…
permissive · top 15,000 on PyPI
django-utils-sixProvides a backport of Django 2.2's…
permissive · top 15,000 on PyPI
djangorestframeworkBuilds web APIs on top of Django with…
permissive · top 1,000 on PyPI
django-upgradeAutomatically modernizes Django project code by…
permissive · top 15,000 on PyPI
django-pipelinedjango-pipeline bundles and compresses CSS and…
permissive · top 15,000 on PyPI
django-sesamedjango-sesame provides token-based…
permissive · top 15,000 on PyPI