This commit is contained in:
parent
b94235fb75
commit
da3f9324b6
|
@ -33,4 +33,12 @@ create table platform_infos (
|
|||
) comment='平台信息';
|
||||
|
||||
|
||||
create table news (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
comment_time varchar(255) comment '评论时间',
|
||||
content varchar(1024) comment '评论内容',
|
||||
comment_id varchar(255) comment '评论ID',
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
)comment='最新抓取的20条信息';
|
||||
|
|
|
@ -28,3 +28,12 @@ class PlatformInfos(models.Model):
|
|||
class Meta:
|
||||
managed = False
|
||||
db_table = 'platform_infos'
|
||||
|
||||
class News(models.Model):
|
||||
comment_time = models.CharField(max_length=255, blank=True, null=True)
|
||||
content = models.CharField(max_length=1024, blank=True, null=True)
|
||||
comment_id = models.CharField(max_length=255, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'news'
|
|
@ -120,19 +120,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>9月21日感染性腹泻发病:123人次</td><td>2018-11-05</td></tr>
|
||||
<tr><td>2</td><td>9月20日流行性感冒:57人次</td><td>2018-11-03</td></tr>
|
||||
<tr><td>3</td><td>9月19日:手足口病发病同比增长220%</td><td>2018-11-01</td></tr>
|
||||
<tr><td>4</td><td>9月18日登革热死亡:2人</td><td>2018-10-29</td></tr>
|
||||
<tr><td>5</td><td>9月17日流行性感冒:157人次</td><td>2018-10-27</td></tr>
|
||||
<tr><td>6</td><td>9月15日全区传染病发病人数较低</td><td>2018-10-25</td></tr>
|
||||
<tr><td>7</td><td>9月14日流行性感冒:157人次</td><td>2018-10-23</td></tr>
|
||||
<tr><td>8</td><td>9月13日全区传染病发病人数较低</td><td>2018-10-21</td></tr>
|
||||
<tr><td>9</td><td>9月12日流行性感冒:157人次</td><td>2018-10-20</td></tr>
|
||||
<tr><td>10</td><td>9月17日流行性感冒:157人次</td><td>2018-10-27</td></tr>
|
||||
<tr><td>11</td><td>9月15日全区传染病发病人数较低</td><td>2018-10-25</td></tr>
|
||||
<tr><td>12</td><td>9月14日流行性感冒:157人次</td><td>2018-10-23</td></tr>
|
||||
<tr><td>13</td><td>9月13日全区传染病发病人数较低</td><td>2018-10-21</td></tr>
|
||||
{% for new in news %}
|
||||
<tr><td>{{new.comment_id}}</td><td>{{new.content}}</td><td>{{new.comment_time}}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,10 @@ def crawl(request):
|
|||
# info = scrapy_client.get_scrapy_info()
|
||||
crawl_info = CrawlInfos.objects.order_by('-id').first()
|
||||
platform_info = get_platform_info()
|
||||
return render(request, 'myapp/crawl.html', {"crawl_info": crawl_info, "platform_info":json.dumps(platform_info)})
|
||||
news = News.objects.all()
|
||||
return render(request, 'myapp/crawl.html', {"crawl_info": crawl_info,
|
||||
"platform_info":json.dumps(platform_info),
|
||||
"news": news})
|
||||
|
||||
def result(request):
|
||||
return render(request, 'myapp/result.html')
|
Loading…
Reference in New Issue