Django url debugger

前端 未结 4 587
逝去的感伤
逝去的感伤 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条回答
  •  你的背包
    2021-02-05 04:22

    I would comment out the patterns in your url.py until you get a 404 error when you try to navigate to foo. If that pattern is an include, I would recurse down that and comment out lines in that url.py. Eventually you will know exactly which pattern is matching.

    Then I would take the view function that it is calling and hard code that. If it is using a generic view or something subtle, I'd make it as obvious and direct as possible. At that point, you should know which rule is matching and why and what code it is executing in the view.

提交回复
热议问题