Django 使用HTTP响应头呈现\u到\u响应

Django 使用HTTP响应头呈现\u到\u响应,django,http-headers,render-to-response,Django,Http Headers,Render To Response,如何将HTTP响应头与Django render_to_响应一起使用 我想使用缓存控制,但无法判断它是否工作。以下各项是否正确: render_to_response(templatename, {'Cache-Control':'no-cache'},context_instance=RequestContext(httpreq)) 直接在响应对象上设置标题 response = render_to_response(...) response['Cache-Control'] = 'no

如何将HTTP响应头与Django render_to_响应一起使用

我想使用缓存控制,但无法判断它是否工作。以下各项是否正确:

render_to_response(templatename, {'Cache-Control':'no-cache'},context_instance=RequestContext(httpreq))

直接在响应对象上设置标题

response = render_to_response(...)
response['Cache-Control'] = 'no-cache'
return response