DjangoURL反向解析
#添加书籍 url(r'^add_book/', views.add_book,name='abook'), #name='abook' 别名 # 删除书籍 url(r'^delete_book/(\d+)/', views.delele_book,name='delete_book'), 视图: from django.urls import reverse reverse('别名') reverse('abook') -- /add_book/ #不带参数的 print(reverse('delete_book',args=(71,))) #/delete_book/71/ 带参数的 模板: {% url 'abook' %} 无参数的 {% url 'delete_book' book.id %} 无参数的