views_misc.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:money-to-prisoners-send-money 作者: ministryofjustice 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号