NoReverseMatch: Обратное соответствие для 'about' не найдено. 'about' не является допустимой функцией представления или именем шаблона

Я создаю блог на django и застрял из-за этой ошибки. Когда я нажимаю на кнопку Readmore, чтобы загрузить полную запись блога, появляется эта ошибка. Она должна загружать страницу, на которой подробно отображается запись блога, а она выдает эту ошибку. Пожалуйста, помогите мне, я пробовал различные решения, которые доступны в Интернете, но не избавился от этой ошибки. enter image description here

Вот мой код!
проект url.py:

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

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

урлы приложений

from django.urls import path
from . import views

urlpatterns = [
      path('', views.PostList.as_view(), name= 'home'),
      path('user/<str:username>/', views.UserPostList.as_view(), name= 'user-posts'),
      path('<slug:slug>', views.PostDetail.as_view(), name= 'post_detail'),
      path('register/', views.Register, name= 'Registration'),
      path('login/', views.Login, name= 'Login'),
      path('logout/', views.logout_view, name= 'Logout'),

]

views.py

from django.db import models
from .forms import NewUserForm
from django.shortcuts import get_object_or_404, redirect, render
from django.http import HttpResponse
from django.contrib.auth import login,logout, authenticate
from django.contrib import messages
from django.contrib.auth.forms import  AuthenticationForm
from django.views import generic
from .models import STATUS, Post
from django.contrib.auth.models import User

class PostList(generic.ListView):
     queryset = Post.objects.filter(status=1).order_by('-created_on')
     template_name = 'Blog_App/index.html'

class UserPostList(generic.ListView):
     model = Post
     template_name = 'Blog_App/user_posts.html'
     context_object_name = 'posts'

def get_queryset(self):
    user = get_object_or_404(User, username=self.kwargs.get('username'))
    return Post.objects.filter(author=user).order_by('-created_on')
    
class PostDetail(generic.DetailView):
    model = Post
    template_name = 'Blog_App/post_detail.html'

def Register(request):
    if request.method == 'POST':
       form = NewUserForm(request.POST)
       if form.is_valid():
           user = form.save()
           login(request, user)
           messages.success(request, 'Registration succesfull')
           return redirect('home')
       messages.error(request, 'Invalid Information')
    form = NewUserForm()
    context = {'register_form': form}
    return render(request, 'Blog_App/register.html', context )

def Login(request):
   if request.method == 'POST':
      form = AuthenticationForm(request, data=request.POST)
      if form.is_valid():
        username = form.cleaned_data.get('username')
        password = form.cleaned_data.get('password')
        user = authenticate(username=username, password=password)
        if user is not None:
            login(request, user)
            messages.info(request, 'Congrats. You logged In! ')
            return redirect('home')
        else:
            messages.error(request, 'Incorrect Credentials!')
    else:
        messages.error(request, 'Invalid Information')

  form = AuthenticationForm()
  return render(request, 'Blog_App/login.html', context={'login_form': form})


def logout_view(request):
    logout(request)
    messages.info(request, 'You are succesfully Logged out')
    return redirect('home')

Base.html`

index.html

{% extends 'base.html' %}
{% load static %}

{% block content %}
<div class="Blog-posts">
   <div class="row">
    
       <div class="div-1">
          <div class="col s12 m6 ">
             {% for post in post_list %}
                  <div class="card card-list blue-grey darken-1">
                    <div class="card-content white-text">
                       <div class="author">
                          <a href="{% url 'user-posts' post.author.username %}">
                             <h5 class="author-name"><img class="author-img" src="{% static 
                              'images/profile.jpg' %}" alt="" height="40px" width="40px">
                                {{post.author}}</h5>
                          </a>
                             <small class="post-created_on">{{post.created_on}}</small>
          
          
                          </div>
                       <span class="card-title">{{post.title}}</span>
                       <p>{{post.content|slice:"200"}}</p>
                    </div>
                    <div class="Readmore-btn">
                       <a href="{% url 'post_detail' post.slug %}" class="waves-effect waves- 
                        light btn-small">Read More</a></div>
          
                  </div>
          
             {% endfor %}
          </div>
       </div>
       <div class="div-2">
          <div class="col m5">
                <div class="card card-sidebar">
                  <div class="card-content black-text">
                    <span class="card-title">About Us</span>
                    <p>I am a very simple card. I am good at containing small bits of 
                     information.
                    I am convenient because I require little markup to use effectively.</p>
                  </div>
                  <div class="card-action">
                    <div class="Readmore-btn_about"><a href="#" class="waves-effect waves- 
                     light btn-small">Read More</a>
          
          
              </div>
       </div>
         </div>
       </div>
    </div>

  </div>
</div>
{% endblock content %}

Если вы столкнулись с такой же проблемой, то вот как я избавился от нее. Django выдает мне ошибку, что в файле base.html есть некий шаблон {% url 'about' %}. Но на самом деле он существует в другом html-файле, который называется post_detail.html. Так что если вы столкнулись с такой же ошибкой, проверьте и другие файлы, и вы найдете ошибку в другом html-файле. Спасибо

Вернуться на верх