"Because it is non-blocking and uses epoll or kqueue, it can handle thousands of simultaneous standing connections, which means the framework is ideal for real-time web services".
To install Tornado just type:
~# apt-get update ~# apt-get install python-tornado ...
This is the basic example to build a simple web server which serves static html file.
Run it by typing:
~/playground/python/tornado# python basic.py
Open a browser on your PC and take a look to the Tornado web page using this URL:
Let's try now to access the default web pages available on /var/www with our new small web server .
Stop basic.py by typing ctrl-c and change this line:
(r"/(.*)", tornado.web.StaticFileHandler, {"path": ".","default_filename": "index.html"})
in:
(r"/(.*)", tornado.web.StaticFileHandler, {"path": "/var/www","default_filename": "index.html"})
In this way we have changed the default path. Start again the web server and reload the web page on your browser.