search

Home  >  Q&A  >  body text

网页爬虫 - python爬虫如何与django结合,实现定时爬取信息与展示?

最近在学习python,在做一个小东西练手,遇到了这样的问题
大概是这样的,我已经写好了一个爬虫能够自动爬取新闻网站的内容,然后存入数据库。但是 不能够自动运行。
然后使用django读取数据库中的新闻信息并展示。
请问二者能否结合起来,实现爬虫定时运行爬取新闻。django实时展示新闻内容。

高洛峰高洛峰2769 days ago544

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-17 15:55:02

    Django is just a web framework. What it does is extract content from the database and then display it.

    The crawler script is another thing. The simplest one is to write it into the table corresponding to the Django model after crawling. You can use crontab or celery for timing, and there is a django-celery project.

    reply
    0
  • 黄舟

    黄舟2017-04-17 15:55:02

    Yes. 34miao.com is the situation you mentioned.
    (1) Website built with django.
    (2) Use python crawler to automatically capture data.

    reply
    0
  • Cancelreply