开发者

Why doesn't my urls.py work?

u开发者_如何学Gorl(r'^video/?$','stuff.abc.views.video',name="video"),

This doesn't work:

<a href="{% url video %}">Videos</a>

But this works:

<a href="/video">Videos</a>

the error is:

TemplateSyntaxError at /
Caught ViewDoesNotExist while rendering: Tried ad in module stuff.abc.views. Error was: 'module' object has no attribute 'ad'


The url itself isn't breaking things, it's the stuff.abc.views module that has the error.

Somewhere in that module (and probably in the video view function), you are attempting to access an attribute called ad that doesn't exist.

The error is confusing because it says ViewDoesNotExist, but that's really just Django getting confused because it expects to be catching an attribute error for a different reason right there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜