你好,游客 登录 注册 搜索
背景:
阅读新闻

Tornado 4.0 发布下载,Web 服务器

[日期:2014-07-16] 来源:oschina.net   作者:Linux [字体: ]

Tornado 4.0 发布下载,此版本值得关注的特性如下:

高性能Tornado框架简单实现restful接口及运维开发实例 http://www.linuxidc.com/Linux/2013-09/90473.htm

  • The tornado.web.stream_request_body decorator allows large files to be uploaded with limited memory usage.

  • Coroutines are now faster and are used extensively throughout Tornado itself. More methods now return Futures, including most IOStreammethods and RequestHandler.flush.

  • Many user-overridden methods are now allowed to return a Futurefor flow control.

  • HTTP-related code is now shared between the tornado.httpserver,tornado.simple_httpclient and tornado.wsgi modules, making support for features such as chunked and gzip encoding more consistent.HTTPServer now uses new delegate interfaces defined in tornado.httputilin addition to its old single-callback interface.

  • New module tornado.tcpclient creates TCP connections with non-blocking DNS, SSL handshaking, and support for IPv6.

向后兼容:

  • tornado.concurrent.Future is no longer thread-safe; useconcurrent.futures.Future when thread-safety is needed.

  • Tornado now depends on the certifipackage instead of bundling its own copy of the Mozilla CA list. This will be installed automatically when using pip or easy_install.

  • This version includes the changes to the secure cookie format first introduced in version 3.2.1, and the xsrf token change in version 3.2.2. If you are upgrading from an earlier version, see those versions’ release notes.

  • WebSocket connections from other origin sites are now rejected by default. To accept cross-origin websocket connections, override the new method WebSocketHandler.check_origin.

  • WebSocketHandler no longer supports the old draft 76 protocol (this mainly affects Safari 5.x browsers). Applications should use non-websocket workarounds for these browsers.

  • Authors of alternative IOLoop implementations should see the changes to IOLoop.add_handler in this release.

  • The RequestHandler.async_callback and WebSocketHandler.async_callbackwrapper functions have been removed; they have been obsolete for a long time due to stack contexts (and more recently coroutines).

  • curl_httpclient now requires a minimum of libcurl version 7.21.1 and pycurl 7.18.2.

  • Support for RequestHandler.get_error_html has been removed; override RequestHandler.write_error instead.

其他

更多内容请看这里

Tornado web server 是使用Python编写出來的一个极轻量级、高可伸缩性和非阻塞IO的Web服务器软件,著名的 Friendfeed 网站就是使用它搭建的。

Tornado 跟其他主流的Web服务器框架(主要是Python框架)不同是采用epoll非阻塞IO,响应快速,可处理数千并发连接,特别适用用于实时的Web服务。

要使用它,必须按照以下套件:

1)Python(建议使用Python 2.5 / Python 2.6)
2)Simplejson(建议使用simplejson 2.0.9)
3)cURL(建议使用curl 7.19.7或以上版本)
4)Pycurl(建议使用pycurl 7.16.2.1)
5)Tornado Web Server(这才是主角,版本就照官網上最新的安裝吧)

一个最简单的服务:

import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

Tornado 的详细介绍请点这里
Tornado 的下载地址请点这里

本文永久更新链接地址http://www.linuxidc.com/Linux/2014-07/104204.htm

linux
相关资讯       Tornado 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款