hello,
need yor help with a simple project ,
I have lighttpd running on my PI and I want to create a webpage with python that will show me updated data from sensors on my PI (and all kind of python code output I'm running)
what will be the best way to make it?
Thanks,
no need for public
this is just for my home private netwrok
no other solution because I'm allready using lighttpd for pi-hole?
or it's best not to mix apps?
Thanks ,
Flask is 100% the best go to here.
If you do something such as:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
a = 100 + 100
return a
Then that will show 200 on your webpage in basic text (I think it shows it in HTML's paragraph font/size but can't remember off the top of my head). The URL would be "www.mydomain.com/" aka the Index page or home page, if you wanted to have multiple pages, you can change the "@app.route('/')" to whatever you want it to be, for example if you had a page describing the characteristics of owls, you could do "@app.route('/owls')".
If you link it up to a database, you can then use SQLAlchemy to connect to the DB and the site can be built to automatically update based on the info in the DB. So instead of having to mess with the code, you'd just refresh the page and bam!