推荐学习书目
› 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
louzhumuyou
V2EX  ›  Python

flask 部署中 gunicorn 的参数--reload 和 --preload 有点不明白的地方

  •  
  •   louzhumuyou · Aug 30, 2017 · 6732 views
    This topic created in 3315 days ago, the information mentioned may be changed or developed.
    看过官方的文档,关于--reload 和--preload 有些不太了解的地方,我的启动服务的全命令是 gunicorn --b xxxxx --workers 3 wsgi:application --preload --reload

    这里的--preload 是因为我的服务中有有一个后台定时的任务,是用 BackgroundScheduler 设置的,类似于 cron 的形式,但是我希望只有一个 worker 会启用,故而增加了 preload 参数,增加--reload 是为了检测到 code 变化自动重启服务,但是我现在验证了当代码变更时候,虽然后台显示已经服务重启,但是实际并没有效果,是因为这里的--preload 造成的吗?但是如果我不加这个参数,该如何实现,只有一个 worker 执行 Scheduler 呢?
    2 replies  •  2017-08-31 13:33:15 +08:00
    janxin
        1
    janxin  
       Aug 30, 2017
    The reloader is incompatible with application preloading.
    louzhumuyou
        2
    louzhumuyou  
    OP
       Aug 31, 2017
    @janxin 不兼容,那有什么好着吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   800 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 21:28 · PVG 05:28 · LAX 14:28 · JFK 17:28
    ♥ Do have faith in what you're doing.