【发布时间】:2016-09-29 09:41:27
【问题描述】:
我想添加 http 标头,但它不起作用。 我正在尝试使用打印来测试解决方案,但它似乎什么也没有
这是我的代码,但不起作用:
class MyRedirectView(RedirectView):
def head(self, *args, **kwargs):
response = HttpResponse()
response['X-Robots-Tag'] = 'noindex'
print('TEST')
return response
【问题讨论】:
标签: python django http-headers django-class-based-views