Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 Windows 服务中运行 web.application,但我找不到在 application.run() 之后以编程方式停止它的方法。
我尝试了 sys.exit,但它不适用于 Windows 服务。
我通过查看web.py源代码解决了我最初提出的问题,并将web/httpserver.py中的WSGIServer暴露给web/application.py,这样我就可以在application.stop()中调用WSGIServer.stop(),这是我自己添加的。
这是一个快速的黑客,不是那么整洁,但它很快就删除了阻止程序。