django-planet
July 21, 2025

Django: iterate through all registered URL patterns

published by Adam Johnson
in blog Adam Johnson
original entry Django: iterate through all registered URL patterns

I’ve found it useful, on occasion, to iterate through all registered URL patterns in a Django project. Sometimes this has been for checking URL layouts or auditing which views are registered.

In this post, we’ll look at a pattern for doing that, along with an example use case …