Flask is a tool for having the pi host a local webserver (A web server is a computer that runs websites). Flask should be pre-installed on the Pi.
Project by Thijs Simonian 2022. A web-based interactive todo list that shows up on an eink display.
Start by creating your Python/Flask application in Thonny. The basic example to get you started is flaskserver_simple.py
Python and Flask will manage the collection of Data.
HTML will take care of displaying everything in a browser.
Javascript (in the same document as the HTML) will take care of the interactivity in the browser.
You'll need to create a folder in the same directory as the Python file. This directory must be called templates.
In the templates folder you to have an HTML file called index.html. (you already have the file but you'll need to change the name from input-index.html to index.html)
When you run the code in Thonny, you'll see a link show up in the shell something like http://0.0.0.0:5000/. Click on that link to open your web application in a browser.
Take a minute to interact with this application. Anything you type and submit, should be stored and displayed on the page.
Any device on the same network (like your phone) can also interact with this web application. Type your Pi's IP address into a browser with :5000 on the end. Example: 10.1.15.75:5000
Note: to see the updates on your Pi's page, click the refresh button.
Understanding some of what is going on in the Python document:
And in the index.html
Challenges / Take it further:
Can you create a button that can remove data?
Can you store data from two different input fields?
Style the web app to make it look more interesting