Html 斜杠(';/';)正在自动添加到路径,即使我有';我没有把它包括在我的URL中,这就是为什么它给出了页面未找到的错误

Html 斜杠(';/';)正在自动添加到路径,即使我有';我没有把它包括在我的URL中,这就是为什么它给出了页面未找到的错误,html,django,web,react-navigation,Html,Django,Web,React Navigation,我已经创建了一个小项目,如果我去注册部分。斜杠(/)会自动添加到URL,并表示找不到页面。但是我的代码中没有包含“/” 这是我的URL.py from django.urls import path from . import views urlpatterns = [ path('register',views.register, name = 'register'), # no slash over here path('login',views.login,name = 'log

我已经创建了一个小项目,如果我去注册部分。斜杠(/)会自动添加到URL,并表示找不到页面。但是我的代码中没有包含“/”

这是我的URL.py

from django.urls import path
from . import views

urlpatterns = [

path('register',views.register, name = 'register'),  # no slash over here


path('login',views.login,name = 'login'),
path('logout',views.logout,name='logout'),
path('checkPincode',views.check,name `enter code here`= 'check'),
]
这是index.html的导航部分

<div class="topnav">
    <a href="/" style="background-color:black; color:#54dfd8;">VIVER FOODS</a>
    <a href="#menu">Food Menu</a>
    <a href="cart/your-cart">Cart</a>
    <a href="help/questions">Help</a>
    {% if user.is_authenticated %}
  
    <a href="/" style="float: right;">Hello, {{ user.first_name }}</a>
    
    <a href="accounts/logout" style="float:right;">LogOut</a>

    {% else %}
    <a href="accounts/register" style="float:right;">SignUp</a>
    <a href="accounts/login" style="float:right;">logIn</a>

    {% endif %}
</div>

{%if user.u经过身份验证%}
{%else%}
{%endif%}

登录工作正常请将a标签中的HREF更改为静态URL。 您可以这样做:

<a href="{% url 'register' %}" style="float:right;">SignUp</a>

您还必须在第1行中包含{%load static%}

这将自动链接到正确的url