V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
IVeverKB
V2EX  ›  Python

[django]启动时如何同时启动多个协程

  •  
  •   IVeverKB · 2020-12-02 15:04:40 +08:00 · 1189 次点击
    这是一个创建于 1231 天前的主题,其中的信息可能已经有所发展或是发生改变。

    主要是想在 django 服务器跑的时候,再用协程去同时处理其他事务。但并不知道把协程写在哪里(具体哪个文件中)比较好。看到 v2 有类似问线程写在哪的问题,会发生写在 url.py 中被重复运行多次的情况,还有 wsgi 架构对这个的影响,提前申明希望可以规避一下。

    另,django 逻辑上应该可以这么构造吧?协程的数据和 django 服务器数据如何传递有什么好的建议吗,比如在协程中从一个 tcp 服务器获取消息,想把这个消息转给与 django 服务器通信的客户端

    1 条回复    2020-12-02 15:39:51 +08:00
    chenzi0103
        1
    chenzi0103  
       2020-12-02 15:39:51 +08:00
    celery 可以解决一部分问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1024 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:12 · PVG 06:12 · LAX 15:12 · JFK 18:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.