id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 1278 MEDIA_URL needs to be accessible from templates matt Adrian Holovaty "I didn't think of the potential security implications of this until I wrote it up (think {{{ {% get_setting DATABASE_PASSWORD %}}}}), but I think it could prove quite useful as a default templatetag. {{{ class SettingNode(Node): def __init__(self, varname, setting): self.setting = setting self.varname = varname def render(self, context): context[self.varname] = self.setting return """" #@register.tag def get_setting(parser, token): """""" Retrieve a setting from the current settings file. The optional as clause can control the variable to be added to the context, otherwise the setting asked for witll be added to the context. For example:: {% get_setting MEDIA_URL [as varname] %} If the setting does not exist in the current settings file, ``None`` will be returned. The following example will return a bulleted list of installed apps:: {% get_setting INSTALLED_APPS %}