Django url debugger

Viewed 10717

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 try to GET http://example.com/foo/edit_profile, it's supposed to execute a view certain view function X but it's executing Y instead. Somewhere the url routing is messing up and I can't figure it out. I used the django.core.urlresolvers.resolve method to try it from the shell and I can confirm that the URL is getting wrongly resolved. However, I don't know how to debug this and pinpoint the problem.

Ideally, I'd like to see something like "tested this pattern", "tested this pattern" etc. till it finally finds the correct one and I can then look around where it resolved. I can't find anything like this.

Isn't this a common problem for larger projects? What do people do?

Update

I know how the system works and how to look through the URLs one by one. That's what I'm trying to do. This question is basically asking for a shortcut.

4 Answers

have you already tried to run

manage.py show_urls

after installing django_extensions?

http://vimeo.com/1720508 - watch from 06:58.

This should give you in what order the url resolution is attempted.

Hope this helps

Related