烧瓶 - 等到磁盘安装完毕 [英] Flask - wait until disk is mounted
问题描述
我首先需要做的是启动应用程序,并显示一个等待页面,直到磁盘被挂载。挂载成功后,应用程序应该重定向到主索引页面。
任何线索?
谢谢
您可以首先返回一个等待页面给用户。而且您可以对Flask服务器执行ajax请求来轮询您的任务(安装磁盘)的状态。当您在ajax响应中获取磁盘时,您可以重定向到主索引页面。
或者您可以使用websocket来通知您的任务的状态。有一个扩展名为 Flask-SocketIO
为你实现websocket。
I am trying to move my console app to Flask but I am new to this framework. What I first need to do is to launch the application and show a "waiting" page until a disk is mounted. When the mount succeeds, the application should redirect to the main index page.
Any clue? Thanks
You can return a waiting page to user at first. And you can do ajax request to your Flask server to polling the status of your task(mount disk). When you get disk mounted in ajax response, You can redirect to main index page.
Or you can use websocket to inform the status of your task. There is a extension named Flask-SocketIO
implement websocket for you.
这篇关于烧瓶 - 等到磁盘安装完毕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!