How to exit cleanly from flask and waitress running as a windows pywin32 service
问题 I have managed to cobble together a working demo of a pywin32 windows service running flask inside the pylons waitress wsgi server (below). A niece self contained solution is the idea.. I have spent hours reviewing and testing ways of making waitress exit cleanly (like this and this) but the best I can do so far is a kind of suicidal SIGINT which makes Windows complain "the pipe has been ended" when stopping through the Services control panel, but at least it stops :-/ I guess the