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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-urlmapper-1.0.0.tar.gz
.
File metadata
- Download URL: django-urlmapper-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ede633d4ddba57ba11471500883cf7d8b3d7ad4bd234a18240494472cf665c9 |
|
MD5 | a5037bcb1e6f34edc14e4815a9f43c0c |
|
BLAKE2b-256 | 521face6f78523a4588bbcada3c55654103008a5754c08e95b035f19eccda81e |