weather api
weather api

Reputation: 758

NoReverseMatch at / error in django after url template tag usage

I am having this error after using the template {% url %} tag,

NoReverseMatch at /index/

Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

this happened when I changed href="index" to href="{% url 'index' %}".

my url is

url(r'^index/$', views.index, name='index'),

I tried to remove $ but still the same error?

Upvotes: 0

Views: 132

Answers (1)

Moses Koledoye
Moses Koledoye

Reputation: 78554

The app_name you provided will be used as the namespace for the urls. You should include that in the tag like so:

href="{% url 'actual_app_name:index' %}"

See URL namespaces and included URLconfs.

Upvotes: 1

Related Questions