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

Flask 使用工厂模式创建 app,配置 Celery 时,大家是怎么解决循环 import 的?

  •  
  •   rogwan · Mar 20, 2017 · 2529 views
    This topic created in 3490 days ago, the information mentioned may be changed or developed.

    要让 Celery 服务在 Flask app 的上下文中生效,就须要在 Flask 工厂模式中创建 celery 服务,在具体业务中再 import 。

    如果在 Flask 创建 app 之前,就生成 celery 的服务,又不能在上下文中起效。

    大家是怎么解决相互 import 的问题的?

    2 replies  •  2017-03-20 10:55:30 +08:00
    trdcaz
        1
    trdcaz  
       Mar 20, 2017 via iPhone
    不是有 init_app 方法嘛
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:49 · PVG 03:49 · LAX 12:49 · JFK 15:49
    ♥ Do have faith in what you're doing.