在尝试导航到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>
答案 0 :(得分:2)
请勿使用硬编码网址,而应使用url标签,如下所示:
<li class="nav-item">
<a class="nav-link" href="{% url 'maps' %}">POLLUTION TRACKING</a>
</li>