K. Grewal
K. Grewal

Reputation: 51

Navigation links not working in navbar (Bootstrap)(Django)

I'm creating a website using django 1.10 and python 3.6. My web app is called 'profiles' and project is called 'firstsite'. I used a template from bootstrap which is saved as 'base.html'. I have two pages in my webapp which use template 'home.html' and 'about.html'. Navigation bar is another html file called 'navbar.html'. I'm trying to link 'home' and 'about' in navigation bar. After linking, when i runserver and open 'http://127.0.0.1:8000/' I get 'NoReverseMatch at/' error.

As you can see in navbar.html, {% url 'home' %} should work instead I get this error:

Error Screenshot

If i remove {% url 'home' %} in navbar.html and place #, the website works fine without any error.

Upvotes: 0

Views: 2073

Answers (1)

Astik Anand
Astik Anand

Reputation: 13047

Just use app name before named urls

<li class="active"><a href="{% url 'profiles:home' %}">Home</a></li>
<li><a href="{% url 'profiles:about' %}">About</a></li>

This will work fine.

Upvotes: 1

Related Questions