站点 robots 文件在线生成

2023-02-18 11:56:03 浏览数 (1)

robots 介绍

https://blog.csdn.net/fanghua_vip/article/details/79535639

在线生成链接

http://tool.chinaz.com/robots/

本站 robots.txt

代码语言:javascript复制
User-agent: *
Disallow: 
Crawl-delay: 5
Disallow: /bin/
Disallow: /photos
Sitemap: http://xieboke.net/sitemap.xml

view

代码语言:javascript复制
def robots(request):
    with open("joyoo/robots.txt", "r") as f:
        content = "<pre>"
        for text in f.readlines():
            content  = text
        content  = "</pre>"
    return HttpResponse(content)

urls

代码语言:javascript复制
urlpatterns = [ 
                 url(r'^robots', robots),
              ]

0 人点赞