Django 正则URL
Django 正则URL
Django 正则URL
URL编写
urlpatterns = [
path('admin/', admin.site.urls),
path('login',views.login),
path('signup.html',views.signup),
path('home',views.home.as_view()),
path('dict',views.dict),
# re_path('detail',views.detail),
re_path('detail-(?P<nid>\d+)-(?P<uid>\d+).html',views.detail), #动态的路由
]
views代码
def detail(request,nid,uid):
return HttpResponse(nid)