Tornado Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
A single-page, colour-coded summary of the Tornado essentials, written against Tornado 6.5.10 (released 2026-09-15) and
Python 3.10+ (versions verified 2026-10-07; Tornado 6.6 is only an alpha, so its items are marked upcoming) — the
asyncio.run(main()) skeleton, Application settings, the RequestHandler lifecycle and its input and output methods,
routing and reverse_url, template syntax and UI modules, signed cookies, @authenticated, XSRF and the upcoming
cross_origin_protection, coroutines (gather and multi, run_in_executor, PeriodicCallback), queues and locks,
AsyncHTTPClient, WebSocketHandler and the client, stream_request_body, long polling and Server-Sent Events,
tornado.options and logging, AsyncHTTPTestCase and gen_test, multi-process deployment behind nginx, and a "legacy
to current" strip of what changed since older tutorials — handy for quick memorization or as a
downloadable PDF desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Start here — Python Tornado.
Foundations — Introduction & Architecture, Getting Started, Asynchronous I/O & the Event Loop, Coroutines & asyncio, and Queues & Locks.
The web framework — Applications & Request Handlers, Routing, Error Handling, Templates & UI Modules, Static Files, and Localization.
Security — Authentication & Signed Cookies, XSRF & Cross-Origin Protection, and Third-party Authentication.
HTTP clients, real-time and networking — Async HTTP Client, WebSockets, Streaming, Long Polling & SSE, and TCP Servers, IOStream & Low-level Networking.
Data, configuration and testing — Databases & Async Drivers, Options, Configuration & Logging, and Testing.
Production — Running & Deploying, WSGI Interoperability, and What’s Changed & Migration.
References
The PDF summarizes the official documentation; each source is cited in full on the page listed above that covers it, and in the section bibliography.