I have looked at Bottle and Flask some now, but I am not even sure when to bind the constrained resource (e.g. the serial port) in there framework. So I'm just going to use the core Python WSIG library for now.
My thinking is: I do not want the serial port to open and close with each browser connection. I need to research the WSGI library and make sure it is single threaded so only one connection is accepted at any time. Sounds like that is what Bottle does, but was that on a host with a single
MCUCPU core? That may be more of a problem on an R-Pi3 than an R-PiZero.
When the daemon is running on an R-Pi it will be started with RC.LOCAL, and I will have to stop it with something like "sudo kill -TERM WSGIdaemon-pid".
https://www.raspberrypi.org/documentation/linux/usage/rc-local.mdAny web browser on my local network can then use the daemon as a Cross-Origin shared resource, so I can serve the client page(s) from any server or as a flat file. I am thinking along the lines of using the flat pages to do simple user interfaces for my boards and projects.
I might use Flask, Bottle, or the Apache server to be the server of the flat web pages but the daemon itself can take calls from any sort of program, perhaps a Python program that periodically gathers data through the daemon to pickle, that way I can gather timed data (e.g. soil moisture levels) while still having the web page based controls at hand.