Twisted(asynch server) vs Django(or any other framework)

后端 未结 6 1926
春和景丽
春和景丽 2020-12-28 19:04

I need help understanding what the advantage of using an asynch framework is. Suppose I want to develop a simple chat web app. Why cant I write python code in the Django fra

6条回答
  •  臣服心动
    2020-12-28 19:38

    First off Django is a framework for writing web apps so it provides ORM, html templating, it requires running an http server etc. Twisted helps to write much lower level code than that. You could use twisted to write the http server Django runs on. If you use Django you are limited to http model, with twisted it could be communicating in any protocol you like including push protocols. So for your chat example you get a server that scales better since it can push comments to people who have logged in VS with django every client having to poll repeatedly.

    edited to reflect comments by: sos-skyl

提交回复
热议问题