django url参数别名写法 使用url
from django.conf.urls import url url(r'^date/(?P<year>\d+)/(?P<month>\d+).html', ArticleMonthArchiveView.as_view(), name='date_index'),
参数有两个:year 和month
path参数别名写法
from django.urls import path # Example: /2012/08/ path('<int:year>/<int:month>/',ArticleMonthArchiveView.as_view(month_format='%m'),name="archive_month_numeric"),# Example: /2012/aug/ path('<int:year>/<str:month>/',ArticleMonthArchiveView.as_view(),name="archive_month"),