Tornado 6.5 Documentation
wiki/Links] Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait()if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous interact with blocking code. asyncio Integration Tornado is integrated with the standard library asyncio [https://docs.python.org/3/library/asyncio.html#module-asyncio] module and shares the same event0 码力 | 437 页 | 405.14 KB | 2 月前3Tornado 6.5 Documentation
Tornado Authors May 22, 2025CONTENTS 1 Quick links 3 2 Hello, world 5 3 Threads and WSGI 7 4 asyncio Integration 9 5 Installation 11 6 Documentation 13 6.1 User’s guide . . . . . . . . . . . . . linksCHAPTER TWO HELLO, WORLD Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous features;0 码力 | 272 页 | 1.12 MB | 2 月前3Python 标准库参考指南 3.13
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947 17.10 _thread API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948 18 网络和进程间通信 951 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951 18 API 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042 18.2 socket0 码力 | 2246 页 | 11.74 MB | 9 月前3Python 标准库参考指南 3.13
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 17.10 _thread API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 944 18 网络和进程间通信 947 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947 18 API 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038 18.2 socket0 码力 | 2242 页 | 11.73 MB | 9 月前3Python 标准库参考指南 3.12
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918 17.10 _thread API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918 18 网络和进程间通信 921 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921 18 API 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1010 18.2 socket0 码力 | 2253 页 | 11.81 MB | 9 月前3Python 标准库参考指南 3.12
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918 17.10 _thread API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918 18 网络和进程间通信 921 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921 18 API 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1010 18.2 socket0 码力 | 2253 页 | 11.81 MB | 9 月前3Python 标准库参考指南 3.11.10
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959 17.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960 18 网络和进程间通信 963 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 18.2 socket0 码力 | 2399 页 | 11.19 MB | 9 月前3Python 标准库参考指南 3.11.10
手动上下文管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894 17.9.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896 17.10 _thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896 18 网络和进程间通信 899 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899 18 API 索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 984 18.1.16 用 asyncio 开发 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 18.2 socket0 码力 | 2248 页 | 11.10 MB | 9 月前3Python 标准库参考指南 3.7.13
. . . . . . . . . 794 18.3 asyncio 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 iii 19 网络和进程间通信 797 19.1 asyncio --- 异步 I/O . . . . . . . . 方法。 协程对象Coroutine 和Coroutine 抽象基类的实例都是这个抽象基类的实例。 注解: 在 CPython 里,基于生成器的协程(使用types.coroutine() 或asyncio.coroutine() 包 装的生成器)都是 可等待对象,即使他们不含有 __await__() 方法。使用 isinstance(gencoro, Awaitable) 来检测他们会返回 False。要使用inspect 方法。所有的Coroutine 实例都必须 是Awaitable 实例。参见coroutine 的定义。 注解: 在 CPython 里,基于生成器的协程(使用types.coroutine() 或asyncio.coroutine() 包 装的生成器)都是 可等待对象,即使他们不含有 __await__() 方法。使用 isinstance(gencoro, Coroutine) 来检测他们会返回 False。要使用inspect0 码力 | 1961 页 | 9.14 MB | 9 月前3Python 标准库参考指南 3.8.20
dummy_threading --- 可直接替代 threading 模块。 . . . . . . . . . . . . . . . . . . . . . . 847 18 网络和进程间通信 849 18.1 asyncio --- 异步 I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849 发布 3.8.20 协程 对象和Coroutine ABC 的实例都是这个 ABC 的实例。 注解: 在 CPython 里,基于生成器的协程(使用types.coroutine() 或asyncio.coroutine() 包 装的生成器)都是 可等待对象,即使他们不含有 __await__() 方法。使用 isinstance(gencoro, Awaitable) 来检测他们会返回 False。要使用inspect 方法。所有的Coroutine 实例都必须 是Awaitable 实例。参见coroutine 的定义。 注解: 在 CPython 里,基于生成器的协程(使用types.coroutine() 或asyncio.coroutine() 包 装的生成器)都是 可等待对象,即使他们不含有 __await__() 方法。使用 isinstance(gencoro, Coroutine) 来检测他们会返回 False。要使用inspect0 码力 | 2052 页 | 9.74 MB | 9 月前3
共 30 条
- 1
- 2
- 3