TIMEX
TIMEX

Reputation: 271604

Why doesn't my urls.py work?

url(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'

Upvotes: 1

Views: 247

Answers (1)

Chris W.
Chris W.

Reputation: 39179

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.

Upvotes: 3

Related Questions