Django url debugger

前端 未结 4 684
逝去的感伤
逝去的感伤 2021-02-05 03:51

I\'m developing a django application and over time, the URLs have grown. I have a lot of them with me now and due to some change I made, one view started to malfunction. When I

4条回答
  •  萌比男神i
    2021-02-05 04:01

    Look at your urlconfs, find which urlpattern invokes your view Y and see if the regexp is more general than it ought to be. Try to comment out the urlpattern which causes the false match and see if it correctly matches X.

    Typically, this is not a problem for me, but it does occur. Always keep more specific patterns before general ones. Use static prefixes to divide your url namespace, to prevent false matches.

提交回复
热议问题