Skip to main content

django-urr

Django URL resolver utilities

This package aims to make it easier to introspect and possibly manipulate the URL resolver(s) in Django projects.

We use urr to auto-generate smoke tests for all URLs in the project, but you might come up with other uses. Who knows!

Installation

Install the package using pip install or similar.

To use the management command(s), also add django_urr to your project's INSTALLED_APPS.

urr_list Management Command

You can use the urr_list management command to generate a machine-readable (but human-greppable) list of URLs in your project.

By default, urr_list outputs JSON Lines (jsonl), with each route on a line of its own; this is greppable with standard tools. If you'd prefer, you can also direct urr_list to output a single JSON array with --format=json.

Each route is an object (dict) has the following keys:

  • groups – the named capture groups (route arguments). For unnamed groups, these are named _0, _1, etc. by Django.
  • name – the name of the route, if any
  • namespace – the namespace of the route, if any
  • path – the path of the route, as a Python percent format string
  • pattern – the regex to match the path

Programmatic API

The django_urr.extract_urls() function traverses the tree of URL patterns and returns an iterator of django_urr.extract.URLEntry objects in original mounting order.

Release files for django-urr 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-urr 0.3.0
File Interpreter ABI Platform
django_urr-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / django_urr-0.3.0-py3-none-any.whl

Download URL django_urr-0.3.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40a392187b42e79a96950d974f1f9020721060ef11cdbac24e2d6b3bc5402f56
BLAKE2b-256 checksum
How to use checksums
34802555d9a7474bb21127cdc460b4e5a0c2ddaf29b278a48da9feac61e506fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page