2👍
It is. This isn’t directly documenting the URLs, but I connected the URLs to view documentation in this way:
Make a Sphinx extension that looks something like:
from django.core.urlresolvers import get_resolver
def setup(app):
app.connect('autodoc-process-docstring', process_django_view)
def process_django_view(app, what, name, obj, options, lines):
if what=='function':
res = get_resolver()
if res.reverse_dict.has_key(obj):
url_struct = res.reverse_dict[obj]
lines[:0] = [
"| URL structure: %s\n" % url_struct[0][0][0]
]
Then you need to add it to extensions in your conf.py
and also load in the Django environment like explained here: How to build sphinx documentation for django project
There’s some other stuff like the regex in url_struct
and the parameters that you can include. My own also searches multiple URL resolvers that correspond to different domains.
Source:stackexchange.com