Skip to content

Instantly share code, notes, and snippets.

View realnot's full-sized avatar
🏠
Working from home

Mauro Crociara realnot

🏠
Working from home
View GitHub Profile
@realnot
realnot / show_urls.py
Created January 22, 2018 15:20 — forked from andreif/show_urls.py
A command to show urls of a Django project
import sys
from django.core.management import BaseCommand
from django.conf.urls import RegexURLPattern, RegexURLResolver
from django.core import urlresolvers
def collect_urls(urls=None, namespace=None, prefix=None):
if urls is None:
urls = urlresolvers.get_resolver()
prefix = prefix or []