推荐学习书目
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 · Dec 2, 2020 · 1645 views
    This topic created in 2014 days ago, the information mentioned may be changed or developed.

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

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

    1 replies    2020-12-02 15:39:51 +08:00
    chenzi0103
        1
    chenzi0103  
       Dec 2, 2020
    celery 可以解决一部分问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3892 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 04:17 · PVG 12:17 · LAX 21:17 · JFK 00:17
    ♥ Do have faith in what you're doing.