In Chapter 7, Setting Up a Raspberry Pi Web Server, we created a weather dashboard using the Bootstrap framework with the WeatherDashboardHTML.py file. We will revisit that code and modify it for our home security dashboard.
To create our home security dashboard, do the following:
- Open up Thonny from Application Menu | Programming | Thonny Python IDE
- Click on New to create a new file
- Type the following into the file:
import cherrypyfrom SecurityData import SecurityDataclass SecurityDashboard: def __init__(self, securityData): self.securityData = securityData @cherrypy.expose def index(self): return """ <!DOCTYPE html> <html lang="en"> <head> <title>Home Security Dashboard</title> <meta charset="utf-8"> ...