#Installing Tornado

![](./tornado.png)

<div class="text-success lead">
This article illustrates how to install and test Tornado a scalable, non-blocking web server 
and web application framework useful to write web application written in Python.
</div>

"<i>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</i>". 

* [Tornado overview](http://tornado.readthedocs.org/en/stable/guide/intro.html)

##Installation steps

To install Tornado just type:

<pre class="minicom">
~# <b>apt-get update</b>
~# <b>apt-get install python-tornado</b>
...
</pre>

##Run your first web server

This is the basic example to build a simple web server which serves static html file. 

* The web server: @pg='python/tornado/basic.py'
* A very basic static html file @pg='python/tornado/index.html'
* A binary **favicon.ico** file  

Run it by typing:

<pre class="minicom">
~/playground/python/tornado# <b>python basic.py</b>
</pre>

Open a browser on your PC and take a look to the Tornado web page using this URL:

* [http://acme_board_ip_address:8080](http://acme_board_ip_address:8080)

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:

<pre class="prettyprint">
(r"/(.*)", tornado.web.StaticFileHandler, {"path": ".","default_filename": "index.html"})
</pre>

in:

<pre class="prettyprint">
(r"/(.*)", tornado.web.StaticFileHandler, {"path": "/var/www","default_filename": "index.html"})
</pre>

In this way we have changed the default path. Start again the web server and reload the web page on your browser.

## Related links

* [Tornado Web page](http://www.tornadoweb.org/en/stable/)
* [Tornado documentation](http://www.tornadoweb.org/en/stable/documentation.html)
* [Facebook's Tornado repository on Github](https://github.com/facebook/tornado)
* [Wikipedia definition of Tornado](http://en.wikipedia.org/wiki/Tornado_(web_server))
* [Introduction to Tornado O'Reilly book](http://shop.oreilly.com/product/0636920021292.do) sample code on [GitHub](https://github.com/Introduction-to-Tornado)
* [Tornado Web Server Google Group](https://groups.google.com/forum/?fromgroups#!forum/python-tornado)
* [Tool to generate favicon.ico file on line](http://www.favicon.cc/)

@include='bio_tanzilli'

