Tornado is a scalable,
non-blocking web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
and
web application framework written in
Python. It was developed for use by
FriendFeed; the company was acquired by
Facebook
Facebook is a social media and social networking service owned by the American technology conglomerate Meta Platforms, Meta. Created in 2004 by Mark Zuckerberg with four other Harvard College students and roommates, Eduardo Saverin, Andre ...
in 2009 and Tornado was
open-sourced soon after.
Performance
Tornado is noted for its high performance. Its design enables handling a large number of concurrent connections (i.e., tries to solve the "
C10k problem").
Modules
* An asynchronous
MongoDB driver called Motor.
*
CouchDB drivers called corduroy and trombi.
* Asynchronous driver for
PostgreSQL wrapping psycopg called Momoko
Example
The following code shows a simple web application that displays "
Hello World!" when visited:
import asyncio
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
return tornado.web.Application( r"/", MainHandler),
async def main():
app = make_app()
app.listen(8888)
await asyncio.Event().wait()
if __name__ "__main__":
asyncio.run(main())
See also
*
Django (web framework)
Django ( ; sometimes stylized as django) is a free and open-source software, free and open-source, Python (programming language), Python-based web framework that runs on a web server. It follows the model–template–views (MTV) Architectural ...
*
FastAPI
*
Flask (web framework)
*
Jam.py
*
Pylons project
*
Web2py
*
Comparison of web server software
References
External links
*
{{Meta Platforms
Facebook software
Free software programmed in Python
Free web server software
Python (programming language) web frameworks
Web server software for Linux