Account/register не найден в проекте django

Я новичок в django и начал с основ. Проблема в том, что следуя учебнику, я создал приложение для аккаунта, в котором есть страница регистрации. По какой-то причине, когда я пытаюсь перейти на страницу регистрации, django сообщает мне, что она не соответствует ни одному из путей.

Ниже приведен код: accounts app url.py

from django.urls import path
from . import views
urlpatterns = [
    path('register', views.register, name="register")
 ]

учет просмотров приложения

from django.shortcuts import render

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

register.html is:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registeration</title>
</head>
<body>
    <form action="register" method = "post">
        {% csrf_token %}
        <input type= "text" name="first_name" placeholder="First Name"><br>
        <input type= "text" name="last_name" placeholder="Last Name"><br>
        <input type= "text" name="username" placeholder="UserName"><br>
        <input type= "text" name="password1" placeholder="Password"><br>
        <input type= "text" name="password2" placeholder="Verify Password"><br>
        <input type= "submit">
    </form>
</head>
<body>
    
</body>
</html>
  ```
web_project urls.py
   ```
from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path("", include('travello.urls')),
    path('admin/', admin.site.urls),
    path('accounts/', include('accounts.urls')),
]
urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Ниже приведена ошибка, которую я получаю:

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

[name='index']
admin/
accounts/ register [name='register']
^media/(?P<path>.*)$
The current path, accounts/register.html, didn’t match any of these.

You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

P.s: Я знаю, что этот вопрос уже задавался раньше, но я перепробовал все, все еще не могу понять, где я делаю ошибку.

Вы забыли добавить / к вашему URL

path('register/', views.register, name="register")

в settings.py make:

TEMPLATES = [
    {
        ...
        'DIRS': ['templates'],
        ... 
    }
Вернуться на верх