如何解决此 URL 映射问题?正在显示页面,但 url 不正确

How do I fix this URL mapping problem? The pages are being displayed but the url is incorrect

在这个 Django 应用程序中,我试图转到特定页面,但它采用的路径不正确。你能告诉我我做错了什么吗?

例如。来自 http://127.0.0.1:8000 I am trying to go to http://127.0.0.1:8000/register but it takes me to http://127.0.0.1:8000/dashboard/register.

http://127.0.0.1:8000/register link 工作正常,但如果我手动输入它。

views.py

from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.

def home(request):
    return render(request, 'formfiller/home.html')

def register(request):
    return render(request, 'formfiller/signup.html')

def login(request):
    return render(request, 'formfiller/login.html')

def download(request):
    return render(request, 'formfiller/download.html')

def forgotpw(request):
    return render(request, 'formfiller/forgotpw.html')

def learnmore(request):
    return render(request, 'formfiller/learnmore.html')

def dashboard(request):
    return render(request, 'formfiller/dashboard.html')

def success(request):
    return HttpResponse("Your account has been successfully created.")

urls.py(应用)

from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='home'),
    path('register', views.register, name='signup'),
    path('login', views.login, name='login'),
    path('download', views.download, name='download'),
    path('forgotpw', views.forgotpw, name='forgotpw'),
    path('learnmore', views.learnmore, name='learnmore'),
    path('dashboard', views.dashboard, name='dashboard'),
    path('success', views.success, name='success'),
]

urls.py(主要项目)

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('formfiller.urls')),
    path('register/', include('formfiller.urls')),
    path('login/', include('formfiller.urls')),
    path('download/', include('formfiller.urls')),
    path('forgotpw/', include('formfiller.urls')),
    path('learnmore/', include('formfiller.urls')),
        path('success/', include('formfiller.urls')),
        path('dashboard/', include('formfiller.urls')),
]

你应该只使用一次include('formfiller.urls')

urls.py(应用)

from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='home'),
    path('register', views.register, name='signup'),
    path('login', views.login, name='login'),
    path('download', views.download, name='download'),
    path('forgotpw', views.forgotpw, name='forgotpw'),
    path('learnmore', views.learnmore, name='learnmore'),
    path('dashboard', views.dashboard, name='dashboard'),
    path('success', views.success, name='success'),
]

urls.py(主要项目)

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('formfiller.urls')),
]