The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
This commit adds support of a new instruction {{ pyend }}. {{ pyend }} behaves exactly as the {{ py }} in the manner of including code that will to be executed. Its only specialty is that the code included in the instruction, will be executed in a separate thread after the "generated" html from pyhtml has been served.
Usage: we use it in a microcontroller Web based UI for easy configuration. During the final step of the configuration wizard, the configurations are saved and the device gets rebooted to apply new configuration. In the {{ pyend }} we add the code to wait for a period of time and then power off/on the controller. Its benefit is that the pyhtml page includes a success message, which is first served and then the device gets rebooted, enhancing User Experience.
The alternative of not using this, would be either not to show a success message or to load a new page that would include the reboot code in a {{ py }}.
This commit adds support of a new instruction {{ pyend }}. {{ pyend }} behaves exactly as the {{ py }} in the manner of including code that will to be executed. Its only specialty is that the code included in the instruction, will be executed in a separate thread after the "generated" html from pyhtml has been served.
Usage: we use it in a microcontroller Web based UI for easy configuration. During the final step of the configuration wizard, the configurations are saved and the device gets rebooted to apply new configuration. In the {{ pyend }} we add the code to wait for a period of time and then power off/on the controller. Its benefit is that the pyhtml page includes a success message, which is first served and then the device gets rebooted, enhancing User Experience.
The alternative of not using this, would be either not to show a success message or to load a new page that would include the reboot code in a {{ py }}.
We do not know if this is something that you consider useful though we have been using this for a while and we thought it would be better to share.