Django url调试器 [英] Django url debugger

查看:128
本文介绍了Django url调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个django应用程序,随着时间的推移,URL已经增长。我现在有很多人,由于我做了一些改变,一个视图开始出现故障。当我尝试获取 http://example.com/foo/edit_profile 时,应该执行一个视图某些视图函数 X ,但它正在执行 Y 。 url路由在某处弄错了,我无法弄清楚。我使用 django.core.urlresolvers.resolve 方法从shell尝试它,我可以确认URL被错误地解决了。但是,我不知道如何调试这个问题。



理想情况下,我想看到像测试这个模式,测试这个模式等等,直到它找到正确的,然后我可以看在它解决的地方。我找不到这样的东西



对于大型项目来说,这不是一个常见的问题吗?人们做什么?



更新



我知道系统如何工作,以及如何逐个查看URL。这就是我想要做的。这个问题基本上是要求一个捷径。

解决方案

你已经尝试运行

 code> manage.py show_urls 

安装 django_extensions



http://vimeo.com/1720508 - 从06:58观看



这应该给你按照什么顺序尝试url解决。 / p>

希望这有助于


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.

解决方案

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

这篇关于Django url调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆