何时使用龙卷风,何时使用Twisted/Cyclone/GEvent/其他 [英] When to use Tornado, when to use Twisted / Cyclone / GEvent / other

查看:77
本文介绍了何时使用龙卷风,何时使用Twisted/Cyclone/GEvent/其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下哪个框架/库将是构建现代多用户Web应用程序的最佳选择?我很想拥有一个异步Web服务器,这将使我可以轻松扩展.

Which of these frameworks / libraries would be the best choise for building modern multiuser web application? I would love to have an asynchronous webserver which will allow me to scale easly. What solution will give the best performance / scalability / most useful framework (in terms of easy of use and easy of developing)?

如果它将提供良好的功能(网络套接字,rpc,流式传输等),那就太好了.

It would be great if it will provide good functionality (websockets, rpc, streaming, etc).

每种解决方案的优缺点是什么?

What are the pros and cons of each solution?

推荐答案

" Django 是一个高级Python Web框架,可鼓励快速开发和简洁实用的设计." .如果您要构建类似于电子商务站点的内容,则可能应该使用Django.它将使您的工作迅速完成.您不必担心太多的技术选择.它提供了从模板引擎到ORM所需的一切.对于您构建应用程序的方式,我们会略有怀疑,如果您问我,这很好.它拥有所有其他图书馆中最强大的社区,这意味着可以轻松获得帮助.

"Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design". If you are building something that is similar to a e-commerce site, then you should probably go with Django. It will get your work done quick. You dont have to worry about too many technology choices. It provides everything thing you need from template engine to ORM. It will be slightly opinionated about the way you structure your app, which is good If you ask me. And it has the strongest community of all the other libraries, which means easy help is available.

" 烧瓶 是基于Werkzeug的Python的微框架, Jinja 2和善意" .当心-微框架"可能会产生误导.这并不意味着Flask是一个半熟的库.这意味着烧瓶的核心非常非常简单.与Django不同,它不会为您做出任何技术决策.您可以自由选择任何令您满意的模板引擎或ORM.即使默认情况下它带有Jinja模板引擎,您仍然可以自由选择我们自己的.据我所知,Flask可用于编写API端点(RESTful服务).

"Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions". Beware - "microframework" may be misleading. This does not mean that Flask is a half-baked library. This mean the core of flask is very, very simple. Unlike Django, It will not make any Technology decisions for you. You are free to choose any template engine or ORM that pleases you. Even though it comes with Jinja template engine by default, you are always free to choose our own. As far as I know Flask comes in handy for writing APIs endpoints (RESTful services).

" Twisted 是由python编写的事件驱动的网络引擎" .这是一个高性能的引擎.其速度的主要原因是所谓的延迟. Twisted建立在延期之上.对于那些不了解延迟的人来说,这是通过异步体系结构实现的机制.扭曲非常快.但是不适合编写常规的Webapp.如果您想做一些底层的网络工作,那么您的朋友就会感到困惑.

"Twisted is an event-driven networking engine written in python". This is a high-performance engine. The main reason for its speed is something called as deferred. Twisted is built on top of deferreds. For those of you who dont know about defereds, it is the mechanism through with asynchronous architecture is achieved. Twisted is very fast. But is not suitable for writing conventional webapps. If you want to do something low-level networking stuff, twisted is your friend.

" Tornado 是Python网络框架以及最初由FriendFeed开发的异步网络库,通过使用非阻塞网络I/O,Tornado可以扩展到成千上万的开放连接,使其非常适合长时间轮询,WebSocket和其他需要长期连接的应用程序给每个用户".龙卷风位于Django和Flask之间.如果您想用Django或Flask编写东西,但是如果您需要更好的性能,则可以选择Tornado.如果架构正确,它可以很好地处理C10k问题.

"Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user". Tornado stands some where between Django and Flask. If you want to write something with Django or Flask, but if you need a better performance, you can opt for Tornado. it can handle C10k problem very well if it is architected right.

" Cyclone 是用于Python的Web服务器框架,实现了Tornado API作为扭曲协议" .现在,如果您想要具有与Twisted差不多的性能但易于编写的常规Web应用程序,该怎么办?向飓风打个招呼.我更喜欢飓风而不是龙卷风.它具有与Tornado非常相似的API.实际上,这是龙卷风的叉子.但是问题是它的社区相对较小. Alexandre Fiori是回购协议的唯一主要提交人.

"Cyclone is a web server framework for Python that implements the Tornado API as a Twisted protocol". Now, what if you want something that is nearly as performant as Twisted but easy to write conventional webapps? Say hello to cyclone. I would prefer Cyclone over Tornado. It has an API that is very similar to Tornado. As a matter of fact, this is a fork of Tornado. But the problem is it has relativly small community. Alexandre Fiori is the only main commiter to the repo.

" 金字塔 是一个通用的开放源代码Python Web应用程序开发框架.其主要目标是使Python开发人员更轻松地创建Web应用程序."据我了解,Pyramid与 Flask 非常相似,我认为只要 Flask 合适,就可以使用Pyramid,反之亦然.

"Pyramid is a general, open source, Python web application development framework. Its primary goal is to make it easier for a Python developer to create web applications." I haven't really used Pyramid, but I went through the documentation. From what I understand, Pyramid is very similar to Flask and I think you can use Pyramid wherever Flask seems appropriate and vice-versa.

EDIT :欢迎要求审查其他任何框架!

EDIT: Request to review any other frameworks are welcomed!

来源: http://dhilipsiva.com/2013/05/19/python-libraries-django-twisted-tornado-flask-cyclone-and-pyramid.html

这篇关于何时使用龙卷风,何时使用Twisted/Cyclone/GEvent/其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆