关于 flask 的模板渲染问题: render_template()
我的程序是这样写的
@app.route('/haha')
def run_haha():
p = subprocess.Popen('python /home/test.py',shell=True,stdout=subprocess.PIPE)
c = p.stdout.readline()
while p.poll() == None:
return render_template('haha.html',cout = p.stdout.readline())
我希望把调用子进程的输出作为参数,用模板渲染出来。结果发现,由于子进程(test.py)输出数据量过大,导致程序卡死。 各位大神,你们有什么好的办法处理这种需求?