当前路径 post/1/{% url 'post_edit' post.pk} 与其中任何一个都不匹配

The current path, post/1/{% url 'post_edit' post.pk}, didn't match any of these

我正在学习 Django,目前正在尝试使用按钮来编辑表单。我买了一本书,并按照书上的内容进行了编码,甚至复制并粘贴了作者 github 中的代码,但仍然无法正常工作。我收到错误 "The current path, post/1/{% url 'post_edit' post.pk}, didn't match any of these."

from django.urls import path
from .views import (
    BlogListView,
    BlogUpdateView,
    BlogDetailView,
    BlogCreateView,
)

urlpatterns = [
    path('post/<int:pk>/edit/', BlogUpdateView.as_view(), name='post_edit'),
    path('post/new/', BlogCreateView.as_view(), name='post_new'),
    path('post/<int:pk>/', BlogDetailView.as_view(), name='post_detail'),
    path('', BlogListView.as_view(), name='home'),
]

我希望这会打开一个页面来编辑已发布的博客表单。

您在 {% url 'post_edit' post.pk} 附近犯了一些错误。 它应该类似于 {% url 'post_edit' post.pk %}

{% %} - 当文本被这些分隔符包围时,表示有一些特殊的功能或代码运行,其结果将放在此处。