def robots_txt_view(request):
"""
robots.txt - blocks access on non-prod and refers to sitemap.xml
@param request: the HTTP request
"""
if settings.ENVIRONMENT != 'prod':
robots_txt = 'User-agent: *\nDisallow: /'
else:
robots_txt = 'Sitemap: %s' % request.build_absolute_uri(reverse('sitemap_xml'))
response = HttpResponse(robots_txt, content_type='text/plain')
return make_response_cacheable(response)
views_misc.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录