Scrapy 配置
New in version 2.4.0.
When a setting references a callable object to be imported by Scrapy, such as a > class or a function, there are two different ways you can specify that object:
- As a string containing the import path of that object
- As the object itself
2.4.0版本之后,scrapy支持两种配置方式
- 使用import path
- 使用object
示例
from mybot.pipelines.validate import ValidateMyItem
ITEM_PIPELINES = {
# passing the classname...
ValidateMyItem: 300,
# ...equals passing the class path
‘mybot.pipelines.validate.ValidateMyItem‘: 300,
}
更多内容参见: Scrapy Settings