Tornado is a Python web framework.
Its main features are:
- Pay attention to speed. It uses non-blocking I/O and can support high concurrent connections.
- Using an event-driven architecture, it is very suitable for network programming.
- Support HTTP client and server.
- Support WebSocket programming.
- Easy to expand.
The main components of Tornado:
- HTTP Server: Used to develop web applications. Has its own URL routing.
- HTTP Client: Used to send requests to other HTTP services.
- IOLoop: An event-driven I/O loop that provides support for non-blocking I/O.
- Asynchronous networking library: Provides a coroutine-oriented network library.
- Template engine: Used to render HTML templates.
- WebSocket support: supports the WebSocket protocol.
Example of use:
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def