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.

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

Install Tornado on Aria, Terra or FOX boards

Download and save the file tornado-x.x.x.tar.gz on the CORE9G25 board microSD which contains the latest stable version of Tornado from the following link:

Untar the archive file:

debarm:~# tar xvzf tornado-x.x.x.tar.gz

Move into the new directory and install Tornado by typing:

debarm:~# cd tornado-x.x.x                                                      
debarm:~/tornado-x.x.x# python install

Run your first web server

This is the basic example to build a simple web server which serves static html file., The web server, Position: CD://Debian/playground/python/tornado/

import tornado.ioloop
import tornado.web

application = tornado.web.Application([
	(r"/(.*)", tornado.web.StaticFileHandler, {"path": ".","default_filename": "index.html"})

if __name__ == "__main__":

index.html, A very basic static html file. Position: CD://Debian/playground/python/tornado/index.html

I'm your default index page
  • A binary favicon.ico file

Run it by typing:

debarm:~/playground/python/tornado# python

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 by typing ctrl-c and change this line:

(r"/(.*)", tornado.web.StaticFileHandler, {"path": ".","default_filename": "index.html"})


(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.

Related links

Documentation Terms of Use
The Acme Systems srl provides this Debian system development and user manual.
The origin of these doc came from the website:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License

Market Mail :
Support Mail: Sales Phone: +86-755-29638421

CoreWind Online Chat>
Work time: 09:00-18:00
Copyright @ 2014 to 2020 - CoreWind Tech.