Django 失败爬行器的报废状态页面

Django 失败爬行器的报废状态页面,django,web-scraping,Django,Web Scraping,我制作了一个蜘蛛来抓取新闻,下面是代码 class AbcSpider(XMLFeedSpider): handle_httpstatus_list = [404, 500] name = 'abctv' allowed_domains = ['abctvnepal.com.np'] start_urls = [ 'http://www.abctvnepal.com.np', ] def parse(self, response): if response.status in

我制作了一个蜘蛛来抓取新闻,下面是代码

class AbcSpider(XMLFeedSpider):
handle_httpstatus_list = [404, 500]
name = 'abctv'
allowed_domains = ['abctvnepal.com.np']
start_urls = [
    'http://www.abctvnepal.com.np',
]

def parse(self, response):

    if response.status in self.handle_httpstatus_list:
        return Request(url="http://google.com", callback=self.after_404)

    hxs = HtmlXPathSelector(response) # The XPath selector
    sites = hxs.select('//div[@class="marlr respo-left"]/div/div/h3')
    items = []
    for site in sites:
        item = NewsItem()
        item['title'] = escape(''.join(site.select('a/text()').extract())).strip()
        item['link'] = escape(''.join(site.select('a/@href').extract())).strip()
        item['description'] = escape(''.join(site.select('p/text()').extract()))
        item = Request(item['link'],meta={'item': item},callback=self.parse_detail)
        items.append(item)
    return items

def parse_detail(self, response):
    item = response.meta['item']
    sel = HtmlXPathSelector(response)
    details = sel.select('//div[@class="entry"]/p/text()').extract()
    detail = ''
    for piece in details:
        detail = detail + piece
    item['details'] = detail
    item['location'] = detail.split(",",1)[0]
    item['published_date'] = (detail.split(" ",1)[1]).split(" ",1)[0]+' '+((detail.split(" ",1)[1]).split(" ",1)[1]).split(" ",1)[0]     
    return item

def after_404(self, response):
    print response.url
我想要的是,如果蜘蛛不工作或不爬行,那么我想显示一个状态页面,说蜘蛛不工作。我该怎么做??如何创建状态页??有什么帮助吗


我已将此与django集成。我可以在django中创建一个url来显示状态吗。如果是,那么我如何才能在不提供任何清晰示例的情况下只采取步骤更好地感谢链接

创建django项目 在项目中创建单个视图 此单一视图必须能够以某种方式连接到您的webcrawler:P。有几种方法可以做到这一点: 在数据库中写入一些状态更新,您可以将django项目包含到python路径中,并在爬虫程序中访问django orm。您必须创建模型来保存数据,但这并不困难。 您可以使用可能希望签出的某种消息队列。这可能是最复杂的选项,因为它需要设置和配置不同的软件。 或者,您可以通过在视图中执行shell命令并确认是否存在正确pid的进程来检查您的进程是否正在运行。 根据方法4返回数据。5.或者从视野中看6。