Tornado (web server)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Tornado
Original authorFriendFeed
DevelopersBen Darnell, Meta, Bret Taylor
Initial release2009; 17 years ago (2009)
Repositorygithub.com/tornadoweb/tornado
Written inPython
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemCross-platform
    Available inEnglish
    TypeWeb server
    LicenseApache License 2.0

    Tornado is a scalable, non-blocking web server and web application framework written in Python.[1] It was developed for use by FriendFeed; the company was acquired by Facebook in 2009 and Tornado was open-sourced soon after.[2]

    Performance

    [edit | edit source]

    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

    [edit | edit source]
    • An asynchronous MongoDB driver called Motor.
    • CouchDB drivers called corduroy and trombi.
    • Asynchronous driver for PostgreSQL wrapping psycopg called Momoko

    Example

    [edit | edit source]

    The following code shows a simple web application that displays "Hello World!" when visited:[3]

    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

    [edit | edit source]

    Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

    References

    [edit | edit source]
    1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    [edit | edit source]
    • Lua error in Module:Official_website at line 94: attempt to index field 'wikibase' (a nil value).