我正在Flask上运行一个web服务器,我想在脚本createHTML.py完成后呈现一个html(index.html)
@app.route('/scan')
def cakes():
os.system('python3 createHTML.py')
return render_template('index.html')
由于这个脚本需要太长的时间,我得到一个错误,说该网站没有发送任何信息
我怎么能阻止这一切?有没有办法让网站等到脚本完成后再显示页面
这是在按钮上运行的html:
<div style="text-align:center;">
<button href="scan" id="realScanButton" type="button">Scan Network</button>
</div>
这是重定向到python函数的脚本:
<script>
$( document ).ready(function() {
$("#realScanButton").click(function() {
clickEnBotonScan();
});
});
function clickEnBotonScan(){
$("#realScanButton").html('Scanning...');
$("#realScanButton").attr('disabled','disabled');
window.location.href = 'http://localhost:5000/scan';
return true;
}
目前没有回答
相关问题 更多 >
编程相关推荐