Registry / web-framework / tornado

tornado

JSON →
library6.5.8pypypi✓ verified 30d ago

Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. It enables scalable, non-blocking network I/O, making it ideal for applications requiring long-lived connections, such as long polling and WebSockets. The current version is 6.5.5, with a release cadence of approximately every few months.

pip install tornado
INSTALL
IMPORT
SIG · TORNADO
T
tornado
web-frameworkpythonv6.5.8
Install
1.9s avg
Import
384ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v6.5.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.408s · 21.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.9s · import 0.360s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RequestHandler
✓ from tornado.web import RequestHandler
Ensure correct import path to avoid ImportError
Application
✓ from tornado.web import Application
Ensure correct import path to avoid ImportError
IOLoop
✓ from tornado.ioloop import IOLoop
Ensure correct import path to avoid ImportError

A simple Tornado application that responds with 'Hello, world' to GET requests on the root URL.

import asyncio from tornado.web import Application, RequestHandler from tornado.ioloop import IOLoop class MainHandler(RequestHandler): def get(self): self.write('Hello, world') def make_app(): return Application([ (r'/', MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == '__main__': asyncio.run(main())
Debug
Known issues
breakingIOLoop.add_callback_from_signal is deprecated and will be removed in Tornado 7.0. Use asyncio.loop.add_signal_handler instead.
fix
Replace IOLoop.add_callback_from_signal with asyncio.loop.add_signal_handler.
affects: <=6.4.0
deprecatedThe client_secret argument to OAuth2Mixin.authorize_redirect is deprecated and will be removed in Tornado 7.0.
fix
Remove the client_secret argument from OAuth2Mixin.authorize_redirect calls.
affects: <=6.4.0
gotchaTornado is not thread-safe. Ensure that Tornado objects are not accessed from multiple threads simultaneously.
fix
Use IOLoop.add_callback to schedule callbacks on the main thread.
affects: all
Errors
Common errors & fixes
No handlers could be found for logger "tornado.access"
Tornado's default access logger tries to log HTTP requests but no logging handlers are configured in the Python standard logging library for the 'tornado.access' logger.
fix
Configure Python's logging system to add a handler, for example: `import logging; logging.basicConfig(level=logging.INFO)` or configure specific handlers for `logging.getLogger('tornado.access')`.
TypeError: 'generator' object is not awaitable
This error typically occurs in Python 3.5+ when an `async def` function uses the `yield` keyword instead of `await`, or when an object that is a generator (e.g., from `@tornado.gen.coroutine` without proper conversion) is passed to `await`.
fix
Replace `yield` with `await` in `async def` functions, and ensure all asynchronous operations return awaitable objects (e.g., futures, coroutines). If using old `@tornado.gen.coroutine` code, consider converting it to `async def` or ensure it's called using `yield from` in compatible contexts.
RuntimeError: Cannot run `IOLoop.run_sync` without a current IOLoop
`IOLoop.run_sync()` is called from a context (e.g., a new thread or script without a Tornado application running) where no `IOLoop` has been initialized or set as the current IOLoop for that thread.
fix
Ensure `IOLoop.current()` is available and initialized in the execution context where `run_sync` is called. If running async code from a synchronous entry point, start the IOLoop first, e.g., `IOLoop.current().start()` or `IOLoop.current().run_sync(your_async_function)` within an already running IOLoop's context.
AttributeError: module 'tornado' has no attribute 'web'
This happens when the `tornado` package is imported generally (e.g., `import tornado`), but submodules like `web` are then accessed as direct attributes of the `tornado` module, which is incorrect.
fix
Import the specific submodule directly: `from tornado import web` or `import tornado.web`.
Upgrade
Version history
6.5.8latest on PyPI · released Aug 7, 2026
Audit
Dependencies
asynciorequiredTornado integrates with asyncio for asynchronous programming
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
2
Resources
tornado — pip install tornado · libregistry