ideadlyfury wrote: ↑
Thu Apr 26, 2018 6:37 am
I have to develop a web page to monitor humidity and temperature for my school project. ....then make everything appear online through local web server created using python and flask
you should learn python flask in detail, it is very powerful, and fun, but possibly your time is short.
in the last days i programmed in python3 one shortcut to bring some small stuff online,
and just today i put it in a template you can use.
the strange point about that concept is, the program you play with is a pure python3, has nothing to do with flask and webserver.
but what it does, it sends the line you print on the terminal ( text, sensor data ) also to a file
and manually you can start ( in a other terminal window )
( what the program ( at the beginning) also creates..)
and that puts/serves that html file to the local LAN
so the flask server is used in the most simple way, to serve a static index.html file.
my trick is just when you run the program again ( kind of offline ) it is overwriting that html file...
at the end find just the web-job template
and the code
worst case you can have 3 separate programs running:
-a- your program what reads the sensors and writes it to the database
-b- my template where you change
++ read from database
++ optional some evaluation like min avg max..
++ print to terminal
( i do the rest by copy it to html )
-c- my flask server ( you have to start manually )