I'm getting an %s is not a registered namespace error in Django 1.11. Is there a way to list what all the registered namespaces are?
URL namespaces allow you to uniquely reverse named URL patterns even if different applications use the same URL names. It's a good practice for third-party apps to always use namespaced URLs (as we did in the tutorial). Similarly, it also allows you to reverse URLs if multiple instances of an application are deployed.
Every URLConf module must contain a variable urlpatterns which is a set of URL patterns to be matched against the requested URL.
the reverse function allows to retrieve url details from url's.py file through the name value provided there. This is the major use of reverse function in Django. Syntax: Web development, programming languages, Software testing & others. from django.urls import reverse.
You could do the same what reverse actually does: look them up in the namespace_dict:
from django import urls
url_resolver = urls.get_resolver(urls.get_urlconf())
url_resolver.namespace_dict.keys()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With