プロジェクトのルートで Scrapy シェルを実行しようとしていますが、ある種の DATABASE 設定に関して不明なエラーが発生し続けます。これが SQLAlchemy の問題なのか、それともスキーマ定義の問題なのかわかりません。
scrapy shell http://some_website.com
プロジェクトのパス以外のディレクトリから実行しても問題ありません。
シェルを起動しようとしています:
me@me:~/my_spider$ scrapy shell http://some_website.com
2015-12-13 15:15:58-0800 [scrapy] INFO: Scrapy 0.24.4 started (bot: my_bot)
2015-12-13 15:15:58-0800 [scrapy] INFO: Optional features available: ssl, http11, boto, django
2015-12-13 15:15:58-0800 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'my_spider.spiders', 'DEPTH_LIMIT': 2, 'CONCURRENT_REQUESTS_PER_DOMAIN': 1, 'CONCURRENT_REQUESTS': 1, 'SPIDER_MODULES': [''my_spider.spiders'], 'BOT_NAME': 'my_bot', 'COOKIES_ENABLED': False, 'LOGSTATS_INTERVAL': 0, 'DOWNLOAD_DELAY': 5}
2015-12-13 15:15:58-0800 [scrapy] INFO: Enabled extensions: TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState
2015-12-13 15:15:59-0800 [scrapy] INFO: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, RandomUserAgentMiddleware, ProxyMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, ChunkedTransferMiddleware, DownloaderStats
2015-12-13 15:15:59-0800 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware
そしてここにトレースバックがあります:
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 89, in _run_print_help
func(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 150, in _run_command
cmd.run(args, opts)
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/shell.py", line 46, in run
self.crawler_process.start_crawling()
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 124, in start_crawling
return self._start_crawler() is not None
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 139, in _start_crawler
crawler.configure()
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 47, in configure
self.engine = ExecutionEngine(self, self._spider_closed)
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/engine.py", line 65, in __init__
self.scraper = Scraper(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/scraper.py", line 66, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 50, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 35, in from_settings
mw = mwcls()
File "~/my_spider/pipelines.py", line 14, in __init__
engine = db_connect()
File "~/my_spider/libs/database/__init__.py", line 14, in db_connect
url = URL(**settings.DATABASE)
AttributeError: 'module' object has no attribute 'DATABASE'
アドバイスをいただければ幸いです。