推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
oahebky
V2EX  ›  Python

有点儿困惑: scrapy-redis 使用不同的 db,哪种方式更好?

  •  
  •   oahebky · Apr 30, 2020 · 2463 views
    This topic created in 2338 days ago, the information mentioned may be changed or developed.

    方式一: 直接在 REDIS_PARAMS 中配置 db,如:

    # scrapy project - settings.py
    
    REDIS_HOST = "localhost"
    REDIS_PARAMS = {"db": 7}
    

    方式二: 使用 REDIS_DB (注:需要更新 scrapy-redis 源码),如:

    # scrapy project - settings.py
    
    REDIS_HOST = "localhost"
    REDIS_DB = 7
    


    注:方式二需要修改的 scrapy-redis 源码如下:

    pull request #166

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   843 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 20:45 · PVG 04:45 · LAX 13:45 · JFK 16:45
    ♥ Do have faith in what you're doing.