设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Tornado 4.0发布,Web服务器

2014-7-17 17:09| 发布者: joejoe0332| 查看: 2537| 评论: 0|原作者: oschina|来自: oschina

摘要:   Tornado 4.0 发布,此版本值得关注的特性如下:Thetornado.web.stream_request_bodydecorator allows large files to be uploaded with limited memory usage.Coroutines are now faster and are used extensive ...

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


  • 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 andRequestHandler.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_httpclientand 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 version3.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_handlerin 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; overrideRequestHandler.write_error instead.


  其他

更多内容请看这里


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


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


Tornado 主要分成四个部分:



  一个最简单的服务:

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()


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部