This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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:

/
/about/
/hello/world/
/page/<slug>/
/page/<slug>/edit/
/page/<slug>/history/
/product/<slug>/

Installation

Urlmapper can be installed from PyPI:

pip install django-urlmapper

Credits

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

Release History

Release History

This version
History Node

1.1.0

History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-urlmapper-1.1.0.tar.gz (2.9 kB) Copy SHA256 Checksum SHA256 Source Nov 14, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting