0
나는 장고 프로젝트와 치료 프로젝트를 가지고있다.Django 모델 클래스를 Scrapy 프로젝트에서 가져 오기
나는 django 모델을 치료 프로젝트로 가져오고 싶다.
이 내 거미입니다 :
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.
을 실행했을 때 나는 오류가 발생했습니다 - 누군가가 내가 잘못 뭐하는 거지보고 나를 도울 수 있습니까?
미리 감사드립니다. 당신은 장고의 컨텍스트 외부 모델을 사용하기 전에 initialize Django 필요
장고 모델과 데이터베이스 사이의 접착제를 제공하기 위해 마법의 모든 종류의 작업을 수행하기 위해 settings.py 및 manage.py를 사용 . 모델 파일을 가져 오는 중이라면 시간이 많이 걸릴 것입니다. 다른 방향으로 앉아 있니? –