为什么我的django模板上下文处理器没有被调用

为什么我的django模板上下文处理器没有被调用,django,django-templates,Django,Django Templates,我一定是在设置自定义模板上下文时遗漏了什么,因为它从未被调用过 在设置中: TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "d

我一定是在设置自定义模板上下文时遗漏了什么,因为它从未被调用过

在设置中:

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django_authopenid.context_processors.authopenid",
    "web.context_processors.my_hat",
)
在web/context_processors.py中

from libs.utils import get_hat, get_project, my_hats

print 'heloooo'

def my_hat(request):
    """Insert some additional information into the template context
    """
     
    import pdb
    pdb.set_trace()

    print 'hiiiiiiii'

    return {'hat': get_hat(request),
        'project': get_project(request),
        }
没有任何输出,django处理视图并显示模板,但从未点击此按钮。我错过了什么

谢谢你,我错过的部分:

在view.py中

return render_to_response(template, {
        'tasks': tasks,
    },
    context_instance=RequestContext(request))
在模板中:

  My current hat is {{hat}}
您是否记得在呈现模板时使用

从Django 1.3开始,有一个新的快捷方式函数,默认情况下使用
RequestContext

return render(request, template, {
    'tasks': tasks,
})

不,从我广泛的谷歌搜索的例子没有显示它。。。对我来说,使用
render
而不是
render\u to\u response
似乎是最简单的解决方案。