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

django 的视图函数执行是同步的还是异步的?

  •  
  •   chuanqirenwu · Dec 19, 2016 · 2845 views
    This topic created in 3471 days ago, the information mentioned may be changed or developed.
    比如两个用户同时访问一个 url , django 后台会调用相应的视图函数处理。那么这个处理过程是先完成第一个用户的 request-response 周期后再执行第二个用户的请求呢?还是同时执行两个用户的 request 请求?
    stamaimer
        1
    stamaimer  
       Dec 19, 2016 via iPhone
    没用过 django ,这个应该和你部署方式有关。
    chuanqirenwu
        2
    chuanqirenwu  
    OP
       Dec 19, 2016
    @stamaimer 无论怎么部署,也只是把请求转发到后台来,最终还是 django 处理吧?您用的什么框架,这个框架是如何处理的呢?我知道 tornado 应该是异步的。
    stamaimer
        3
    stamaimer  
       Dec 19, 2016 via iPhone   ❤️ 1
    @chuanqirenwu 一个请求起一个线程
    chuanqirenwu
        4
    chuanqirenwu  
    OP
       Dec 19, 2016
    @stamaimer 谢谢,我好想明白点了,请求会先经过服务器再由 django 处理,因此几个线程取决于服务器的设置。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   774 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 20:02 · PVG 04:02 · LAX 13:02 · JFK 16:02
    ♥ Do have faith in what you're doing.