老是用cmd都快蛋碎了!!!
http://stackoverflow.com/questions/21788939/how-to-use-pycharm-to-debug-scrapy-projects
How to use pycharm to debug scrapy projects:
The
scrapy
command is a python script which means you can start it from inside PyCharm.
When you examine the scrapy binary (
which scrapy
) in VI
you will notice that this is actually a python script:#!/usr/bin/python
from scrapy.cmdline import execute
execute()
This means that a command like
scrapy crawl IcecatCrawler
can also be executed like this: python /Library/Python/2.7/site-packages/scrapy/cmdline.py crawl IcecatCrawler
Try to find the scrapy.cmdline package in PyCharm (for instance with Goto declaration) In my case the location was here:
/Library/Python/2.7/site-packages/scrapy/cmdline.py
Create a run/debug configuration inside PyCharm with that script as script. Fill the script parameters with the scrapy command and spider. In this case
crawl IcecatCrawler
.
Like this:
Put your breakpoints anywhere in your crawling code and it should work™.
没有评论:
发表评论