Django : How can I see a list of urlpatterns?

后端 未结 16 1713
有刺的猬
有刺的猬 2020-11-29 19:36

How can I see the current urlpatterns that \"reverse\" is looking in?

I\'m calling reverse in a view with an argument that I think should work, but doesn\'t. Any wa

16条回答
  •  萌比男神i
    2020-11-29 19:51

    In Django 3.0, it's as easy as:

    from django.urls import get_resolver
    print(get_resolver().url_patterns)
    

    Prints: [, ]

提交回复
热议问题