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.
# FRR:该模块定义评论应用(comments)的URL路由配置,
# 映射评论相关的视图函数/类,实现前端请求与后端处理逻辑的关联。
from django.urls import path # 导入Django的path函数,用于定义URL路径
from . import views # 导入当前应用的views模块,关联评论处理视图
app_name = "comments" # 定义应用命名空间,避免不同应用间URL名称冲突
# FRR:URL路由列表,每个path对应一个评论相关的请求路径
urlpatterns = [
# FRR:评论提交路由,用于处理用户提交评论的请求
# 路径包含文章ID(article_id),通过<int:article_id>捕获整数类型的文章ID参数
# 关联视图类CommentPostView的as_view()方法(将类视图转为可调用视图函数)
# 命名为'postcomment',便于在模板中通过{% url 'comments:postcomment' article_id %}反向解析
path(
'article/<int:article_id>/postcomment',
views.CommentPostView.as_view(),
name='postcomment'),
]