我现在使用beautifulsoup抓取数据我想在我的模型中抓取数据(在我的postgresql中) 我如何使用这个抓取的数据 我的models.py
from __future__ import unicode_literals
from django.db import models
from datetime import datetime
class AppDetail(models.Model):
name=models.CharField(max_length=50,blank=True,null=True,verbose_name='name*')
image=models.ImageField(blank=True,null=True,upload_to='/home/cp/Documents/nApp/appstore/media')
icon=models.ImageField(blank=True,null=True,verbose_name='icon*')
host=models.CharField(max_length=50,blank=True,null=True)
categories=models.ForeignKey(Category,blank=True, null=True ,verbose_name='categories*')
description_of_app=models.TextField(max_length=5000,blank=True,null=True,verbose_name='description_of_app*')
no_of_download=models.IntegerField(default=0,blank=True,null=True)
whats_new=models.TextField(max_length=1000,blank=True,null=True)
additional_information=models.ForeignKey(AdditionalInformation,blank=True,null=True)
price=models.FloatField(null=True, blank=True)
size=models.CharField(max_length=50,blank=True,null=True,verbose_name='size*')
app_priority=models.IntegerField(default=0,blank=True,null=True,verbose_name='app_priority*')
url=models.URLField(blank=True,null=True)
is_active=models.BooleanField(default=True)
image_url = models.URLField(null=True, blank=True)
我的scrap.py
import urllib2
from bs4 import BeautifulSoup
import re
from appdetail.models import *
page = urllib2.urlopen('https://play.google.com/store/apps/details?id=com.igg.clashoflords2&hl=en').read()
soup = BeautifulSoup(page,'html.parser')
"""-----------For app name------------"""
for anchor in soup.findAll('div', {'class': 'id-app-title'}):
app_name=anchor.text
print anchor.text
m=AppDetail.objects
m.name=app_name
m.save()
我想使用废料"名称"我的型号名称中的详细信息