CherryPy is a full webserver including a server side framework. It was chosen because it is reasonable easy to use, still possible to add things like authentication later on. Install cherrypy on the raspberry pi by:
> pip install cherrypy
It is possible to generate a complete webpage from inside python, but it soon tends to create disorder in the code. It is easier to have static html pages on the file system and only generate dynamic content from the code. How is the static html page merged together with the dynamic content? By the use of a template engine. A template engine makes it possible to insert dynamic data into a page at specific places. How is it one? The template engine parses the page, inserts parameters or executes the python code , and generates the final page as html which sent back to the web-browser. The template engine jinja2 was picked, since jinja2 seemed to have the biggest community of the existing ones (2015). Install jinja2 on the raspberry pi by:
> pip install jinja2
A web application in CherryPy is written as a class containing several methods, and in the __main__ method, the application is instantiated together with the web server. If marked correctly, a method in the class is possible to access directly via a REST API call.