README.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Tornado Web Server
  2. ==================
  3. .. image:: https://badges.gitter.im/Join%20Chat.svg
  4. :alt: Join the chat at https://gitter.im/tornadoweb/tornado
  5. :target: https://gitter.im/tornadoweb/tornado?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
  6. `Tornado <http://www.tornadoweb.org>`_ is a Python web framework and
  7. asynchronous networking library, originally developed at `FriendFeed
  8. <http://friendfeed.com>`_. By using non-blocking network I/O, Tornado
  9. can scale to tens of thousands of open connections, making it ideal for
  10. `long polling <http://en.wikipedia.org/wiki/Push_technology#Long_Polling>`_,
  11. `WebSockets <http://en.wikipedia.org/wiki/WebSocket>`_, and other
  12. applications that require a long-lived connection to each user.
  13. Hello, world
  14. ------------
  15. Here is a simple "Hello, world" example web app for Tornado:
  16. .. code-block:: python
  17. import asyncio
  18. import tornado
  19. class MainHandler(tornado.web.RequestHandler):
  20. def get(self):
  21. self.write("Hello, world")
  22. def make_app():
  23. return tornado.web.Application([
  24. (r"/", MainHandler),
  25. ])
  26. async def main():
  27. app = make_app()
  28. app.listen(8888)
  29. await asyncio.Event().wait()
  30. if __name__ == "__main__":
  31. asyncio.run(main())
  32. This example does not use any of Tornado's asynchronous features; for
  33. that see this `simple chat room
  34. <https://github.com/tornadoweb/tornado/tree/stable/demos/chat>`_.
  35. Documentation
  36. -------------
  37. Documentation and links to additional resources are available at
  38. https://www.tornadoweb.org