RHEL6 install python package tornado
RHEL6 install python package tornado
Tornado is a full-stack Web framework and Asynchronous Network library developed using Python. It was first developed by Friendfeed. By using non-blocking IO, Tornado can process tens of thousands of open connections, which is an ideal choice for long polling, WebSockets, and other applications that require maintenance of persistent connections.
Unlike other mainstream Web Server frameworks (mainly Python frameworks), tornado uses epoll for non-blocking I/O and responds quickly. It can process thousands of concurrent connections and is especially suitable for real-time Web services. Tornado consists of four parts:
Web framework (including RequestHandler, the base class used to create Web programs, and various support classes)
Implement HTTP client and server (HTTPServer and AsyncHTTPClient ).
An Asynchronous Network Library (IOLoop and IOStream)
A coroutine Library (tornado. gen) allows the asynchronous call code to be written in a more direct way, replacing the callback link.
One of the simplest Web Services:
import tornado.ioloopimport tornado.webclass MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world")application = tornado.web.Application([ (r"/", MainHandler),])if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
How to install tornado on RHEL6.4
The following describes how to install tornado on RHEL6.4. I am using Python 2.6.6.
1) download tornado-4.1.tar.gz first:
2) unzip the package and install:
# tar -zxvf tornado-4.1.tar.gz# cd tornado-4.1# yum install gcc python-devel# python2.6 setup.py build# python2.6 setup.py install
3) Test the above example
# Python2.6
>>> Import tornado. ioloop
Correct!