skillfed

django-js-reverse

Javascript url handling for Django that doesn't hurt.

django-js-reverse v1.0.0 109.9K downloads/30d#12,495 on PyPI26
Permissive license MIT Active released

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-reverse

uv

uv add django-js-reverse

poetry

poetry add django-js-reverse

Installing 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

Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 5.2Framework :: Django :: 6.0Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

django url reverse javascriptdjango named urls in jsfrontend url generation djangodjango js url routingreverse urls from javascript
django-integrationurl-routing

More Dynamic Content packages