Skip to main content

Print registered urls in a readable format.

Project description

Urlmapper is a library for Django to print out the registered urls for a site in a readable format.

Basic Usage

from mysite.urls import urlpatterns
from urlmapper.utils import get_urls

urls = get_urls(urlpatterns)

for entry in urls:
    print(entry["path"], entry["name"], entry["view"])

A urlpattern like:

extra = [
    url("^world/$", view),

nested = [
    url(r"^(?P<slug>\w+)/", include([
        url(r"^$", view),
        url(r"^history/$", view),
        url(r"^edit/$", view),

urlpatterns = [
    url("^$", view),
    url("^product/(?P<slug>[^/]+)/$", view, name="product-detail"),
    url("^about/$", view, name="about"),
    url("^hello/", include(extra)),
    url("^page/", include(nested)),

Would output like:



Urlmapper can be installed from PyPI:

pip install django-urlmapper


This code was originally modified from the django-extensions library for use in things other than Django management commands.

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-urlmapper, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django-urlmapper-1.1.0.tar.gz (2.9 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