You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DjangoBlog-Maintenance-Anal.../src/urls.py

17 lines
677 B

This file contains ambiguous Unicode characters!

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.

from django.urls import path
# 导入当前应用comments的views模块用于关联视图函数/类
from . import views
# 定义当前应用的命名空间为"comments"避免URL名称冲突
app_name = "comments"
# 定义URL路由列表存储URL规则与视图的映射关系
urlpatterns = [
# 定义评论提交的URL规则
path(
'article/<int:article_id>/postcomment', # URL路径包含文章ID整数类型的动态路径
views.CommentPostView.as_view(), # 关联的视图类调用CommentPostView的as_view()方法生成视图函数
name='postcomment'), # 给该URL命名为"postcomment",用于反向解析
]