我有一个django项目和一个scrapy项目
我想将django模型从scrapy项目导入。
这是我的蜘蛛:
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
import sys
sys.path.append('/home/ubuntu/venv/dict')
from dmmactress.models import EnActress
class JpnNameSpider(scrapy.Spider):
name = jp_name
allowed_domains = ['enjoyjapan.co.kr']
rx = EnActress.objects.values_list('name', flat=True)
rxs = rx.reverse()
start_urls = ['http://enjoyjapan.co.kr/how_to_read_japanese_name.php?keyword=%s' % jp for jp in rxs]
def parse(self, response):
for sel in response('//*[@id="contents"]/div/div[1]/div/div[1]'):
item = JapanessItem()
item['koname'] = sel.xpath('div[4]/div[1]()/text()').extract()
item['jpname'] = sel.xpath('div[2]/div[1]()/text()').extract()
yield item
next_page = response.css('#contents > div > div:nth-child(4) > div > a::attr(href)').extract_first()
if naxt_page is not None:
next_page = response.urljoin(next_page)
yield scrapy.Request(next_page, self.parse)
我跑蜘蛛时出错了
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configure.
- 有人可以帮我看看我做错了吗?
提前致谢!