def test4(request):
logging.debug(request)
logging.debug(request.META['HTTP_REFERER'])
return render_to_response('test2/test4.html', context_instance=RequestContext(request))
在上面的代码中可以请求打印在test4.html以及request.META ['HTTP_REFERER']我试过了
<script>
alert('{{request}}'); //prints empty
alert('{{request.META.HTTP_REFERER}}'); //prints empty
</script>
答案 0 :(得分:1)
您是否已将django.core.context_processors.request
添加到上下文处理器设置中? It's not enabled by default