I’m using Flask on a Raspberry Pi for an IoT application.
My problem is, that I need to cleanly close the connection to my external device before the application is shutdown or restarted by the Flask auto-reloader.
Is there any callback / handler / event / etc. I can use for a clean shutdown? (that also works with the auto-reloader)
Application shutdown is not part of the WSGI server standard. There is no general way to know when the server stops completely from within the application code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With