This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 导入Django的path函数,用于定义URL路径
from django.urls import path
# 导入当前应用下的views模块,用于关联视图函数/类
from . import views
# 定义应用命名空间为"comments",用于在模板中通过命名空间引用URL,避免多应用URL名称冲突
app_name = "comments"
# URL模式列表,定义该应用的URL路由规则
urlpatterns = [
# 定义一个评论提交的URL路径
path(
# URL路径字符串,包含一个整数类型的文章ID参数(article_id),用于指定评论所属的文章
'article/<int:article_id>/postcomment',
# 关联的视图类,使用as_view()方法将类视图转换为可调用的视图函数
views.CommentPostView.as_view(),
# 为该URL指定名称"postcomment",结合应用命名空间可通过"comments:postcomment"引用
name='postcomment'
),
]