Why?I messed about with few different stacks for running a web server on pi, and most are complicated, in particular being complicated to configure as well as being large complicated animals that provide a lot of functionality (and overheads) that were of no real use to me. I wanted something that was:
- simple to install / set up
- suitable for use as an 'inside' home web service (i.e. not exposed to the nasty world outside)
- able to run reasonably fast
- really simple to use (from python in particular)
What?On a LAN connected raspberry pi 3 this approach will happily serve up to 200 requests per second - as long as the overall network bandwidth doesn't get too high.
I wanted to minimise the load on the Raspberry Pi and keep the user interface simple to use and responsive. To do this the python web server is very simple and - after serving up the initial page - just responds to requests from the client.
The web server runs happily on Raspberry Pi (including zero) and on my ubuntu laptop. It appears to work well with Firefox, Chrome and Internet Explorer on laptops / PCs. It does not work in Edge, but as I have little interest in Windoze , I'm not really interested in the ie / edge use.
It will run on reasonably fast phones / tablets, but not at high framerates; my old Galaxy S2 isn't much use, but a Hudl2 works well as long as the framerate is kept low.
This is just a proof of concept, so presentation and error handling are minimal / non-existent, and functionality is limited.
How?There are 2 files:
- a python3 file (the server) of around 100 lines
- an html file (the client) of around 200 lines
You can get the files on github here: