如何將後臺線程添加到燒瓶? - How can I add a background thread to flask?

問題:

I'm busy writing a small game server to try out flask.我正忙於編寫一個小型遊戲服務器來試用燒瓶。 The game exposes an API via REST to users.遊戲通過 REST 向用戶公開 API。 It's easy for users to perform actions and query data, however I'd like to service the "game world" outside the app.run() loop to update game entities, etc. Given that Flask is so cleanly implemented, I'd like to see if there's a Flask way to do this.用戶很容易執行操作和查詢數據,但是我想在 app.run() 循環之外爲“遊戲世界”提供服務以更新遊戲實體等。鑑於 Flask 實現得如此乾淨,我想看看是否有 Flask 方法可以做到這一點。


解決方案:

參考: https://stackoom.com/en/question/yM7v
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章