如何通过单击导航栏导航到其他页面

问题描述 投票:0回答:1

尝试导航到django中的其他页面时如何修复页面未找到错误。

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/maps.html
Using the URLconf defined in wordcount.urls, Django tried these URL patterns, in this order:

[name='home']
info/ [name='info']
countries/ [name='countries']
aircomp/ [name='aircomp']
maps/ [name='maps']
The current path, maps.html, didn't match any of these. 

</li>
<li class="nav-item">
<a class="nav-link" href="maps.html">POLLUTION TRACKING</a>
</li>
django
1个回答
2
投票

请勿对网址进行硬编码,请使用网址标记,如下所示:

<li class="nav-item">
    <a class="nav-link" href="{% url 'maps' %}">POLLUTION TRACKING</a>
</li>