/* jquery */ /* jquery accordion style*/ /* jquery init */

26 July 2015

BottlePy Web Server on a Raspberry Pi

The flexibility of the Raspberry Pi means it can host a number of popular web servers. But they can be rather large and complex and therefore a little intimidating.

So, would you rather have a tiny, fast and lightweight server that implemented entirely in Python?

One of the easiest to get started is with Bottle.

All you'll need to do is download and install the module, then write some code.

The simplest code example is the classic 'Hello World' as below (taken from the Bottle website):

from bottle import route, run

def hello():
   return "Hello World!"

run(host='localhost', port=8080, debug=True)

To test the above code:
  (a) execute the Python program
  (b) point your browser to http://localhost:8080/hello.

A post from my Learn Python on the Raspberry Pi tutorial.