The url() function is passed four arguments, two required: regex and view, and two optional: kwargs, and name. url(r'^$', views.index, name='index'), url(r'^polls/', include('polls.urls')), url(r'^admin/', admin.site.urls), ^匹配输入字符串开始 $匹配输入字符串结束 …
import sys import re #Make sure we have a single URL argument. if len(sys.argv) != 2: print (sys.stderr, "URL Required") sys.exit(-1) #Easie access. url = sys.argv[1] #Ensure we were passed a somewhat valid URL. #This is a superficial test. if r…