django之urlresolver
>>> from django.utils.regex_helper import normalize >>> bits=normalize(r ' ^static/(?P<path>.*)$ ' ) >>> bits [(u ' static/%(path)s ' , [u ' path ' ])] >>> bits=normalize(r ' ^static/(?P<path>.*)/(?P<order>.*)$ ' ) >>> bits [(u ' static/%(path)s/%(order)s ' , [u ' path ' , u ' order ' ])] normalize 函数返回列表,列表的元素是元组,元组的第一项是字符串,第二项是组名字。 django.conf.url可以导入include,patterns,url等函数 def include(arg, namespace=None, app_name= None): if app_name and not namespace: raise ValueError( ' Must specify a namespace if specifying app_name. ' ) if app_name: warnings.warn( ' The app_name argument to django.conf