fromdjangoimporttemplatefromdjango.confimportsettingsregister=template.Library()@register.tagdefsetting(parser,token):try:tag_name,option=token.split_contents()exceptValueError:raisetemplate.TemplateSyntaxError,"%r tag requires a single argument"%token.contents[0]returnSettingNode(option)classSettingNode(template.Node):def__init__(self,option):self.option=optiondefrender(self,context):# if FAILURE then FAIL silentlytry:returnstr(settings.__getattr__(self.option))except:return""