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

想在 flask 中加一个数据处理层, 这个层与 flask 逻辑为分开的,只是共用一套模型层代码,大佬有好的组件推荐么?

  •  
  •   15399905591 · Oct 15, 2019 · 3804 views
    This topic created in 2583 days ago, the information mentioned may be changed or developed.
    该数据处理层是异步的,可以做定时任务,也可以做异步任务
    12 replies  •  2019-10-22 10:19:59 +08:00
    Latin
    Latin
    Oct 15, 2019
    1
    不想重复做轮子就 celery
    15399905591
    15399905591
    OP
    Oct 15, 2019
    2
    @Latin celery 怎么做异步任务呢? 我这里的异步任务是指第三方系统推送一个消息过来,我这边接受到后读取并执行指定任务
    wangyzj
    wangyzj
    Oct 15, 2019
    3
    @15399905591 celery 只是一个任务执行框架,你把任务推过去就行了,第三方消息接收还是需要 flask,或者你单独做一个队列 kafka 之类的处理
    15399905591
    15399905591
    OP
    Oct 15, 2019
    4
    @wangyzj 那第三方怎么推送任务呢?我使用 celery 定义了一个任务,我现在需要一个第三方系统去触发,使用 http api 又有安全问题,这个时候我应该怎么推送任务呢?。
    Jemini
    Jemini
    Oct 15, 2019 via iPhone
    5
    celery 有定时任务啊!可以定时触发么
    imycc
    imycc
    Oct 15, 2019❤️1
    6
    使用 celery 的话,简单点的模型就是 API ---(celery)---> MQ ---(celery)---> Worker 这样。
    依旧是通过 API 对第三方提供服务,安全问题可以通过认证、白名单等方式来解决。
    celery 主要是起到一个任务队列的作用,将 API 这段接受到的任务推给 worker 去处理。
    wzwwzw
    wzwwzw
    Oct 15, 2019
    7
    celery 吧,定时,异步都符合了。http api 做好认证,ip 白名单,问题不大。
    SjwNo1
    SjwNo1
    Oct 16, 2019
    8
    cron & celery
    Latin
    Latin
    Oct 17, 2019
    9
    @15399905591 做个 restful api 接收异步回调,然后调用 celery 任务就好了啊
    15399905591
    15399905591
    OP
    Oct 21, 2019
    10
    @Latin 使用 http 性能是个严重的问题
    Latin
    Latin
    Oct 22, 2019 via iPhone
    11
    @15399905591 那就长连接,用 websocket,再不济你用 rpc
    Harlaus
    Harlaus
    Oct 22, 2019
    12
    APScheduler
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1091 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 18:18 · PVG 02:18 · LAX 10:18 · JFK 13:18
    ♥ Do have faith in what you're doing.