Tornado is a Web framework supports asynchronous by using non-blocking I / O stream, it can support thousands of open access, efficiency is very high, this section will introduce its installation.
1. Links
GitHub:https://github.com/tornadoweb/tornado
PyPI:https://pypi.python.org/pypi/tornado
The official document: http://www.tornadoweb.org
2. pip install
It is recommended to use pip install, related command is as follows:
pip3 install tornado
After machining, to complete the installation.
3. Verify the installation
Also, here you can test it with a Hello World program code is as follows:
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
Run the program directly, can be found in the system is running a Web service in 8888, console output is not content, then access http://127.0.0.1:8888/, can be observed webpage presents Hello, world, shown in Figure 1- 42, which indicates Tornado successfully installed.
Figure 1-42 operating results
4. Conclusion
Later, we will use to build a Tornado + Redis ADSL dial-agent pool.
Source: Huawei cloud community Author: Cui Shu Jing Qing only seek