Menu

Build an Anvil web app and deploy it to a Raspberry Pi

Last time, I did a video tutorial introducing Anvil, a web-based tool for building web apps. Today I have a new video in which I build a new app in Anvil, and then deploy it to be hosted on a Raspberry Pi, to make use of some Raspberry Pi specific features.

This app features a grid of information about the Pi (model, revision code, etc), shows a graph of the Pi’s CPU temperature, and includes a “joke” button which tells you a joke (using pyjokes):

Click through to the video and you’ll see chapter markings along the way.

This wasn’t possible until very recently, when Anvil open-sourced their runtime. This means that you can build your app in Anvil the usual way, but self-host it if you want to. It’s easy to set up on something like an Ubuntu server or Raspberry Pi. You can even build your app without touching the Anvil website, you just don’t have the fantastic developer experience they provide. Maybe I’ll brave that in a future video, once I’ve had some practice!

In the tutorial I actually use several tools I’ve previously covered in this blog:

You can clone the Anvil-hosted version in Anvil by clicking this link.

You can clone the Raspberry Pi version on a Raspberry Pi here: github.com/bennuttall/anvil-rpi-temp-graph

It occurs to me that this tutorial is very Cambridge-centric. I use Anvil, a tool built by a Cambridge-based company; deploy it to a Raspberry Pi, a computer designed in Cambridge; and it’s hosted by Cambridge-based hosting company Mythic Beasts!