from django.conf.urls import url from django.contrib import admin from django.shortcuts import HttpResponse # 路由分发的本质 def test1(request): return HttpResponse(‘text1‘) def test2(request): return HttpResponse(‘text2‘) def test3(request): return HttpResponse(‘text3‘) def test4(request): return HttpResponse(‘text4‘) def test5(request): return HttpResponse(‘text5‘) def test6(request): return HttpResponse(‘text6‘) #路由分发的本质 urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r‘^index/‘, ([url(r‘text1/‘, ([ url(r‘text_1‘, test1), url(r‘text_2‘, test2), url(r‘text_3‘, test3), url(r‘text_4‘, ([url(r‘text_5‘, test5)], None, None)), ], None, None)), url(r‘text2/‘, test6)], None, None)), ]
原文地址:https://www.cnblogs.com/huikejie/p/11277174.html
时间: 2024-10-31 18:24:12