The goal is rendering data to html using django every 5 second, but the problem is the looping does not working. This is the code:
view.py
def form(request):
try:
file_name = request.FILES['files'].name
nama = "uploads/" + file_name
seq_act, num_obsv, observer, list_obsv = pr.readexcel(nama,0)
p, A, B = pr.make_initial(observer,num_obsv)
p_lampau, A_lampau, B_lampau = pr.baum_welch(p, A, B, seq_act)
while True:
if len(temp)==0:
break
seq_act_test = list(temp)
temp[:] = []
real_seq, repair_seq = pr.process(p_lampau, A_lampau, B_lampau,
seq_act_test, observer_test,
num_obsv)
return render(request,'main/form2.html',{'real_seq' : real_seq,
'repair_seq': repair_seq})
time.sleep(5)
except:
return redirect('/main/awal')
form2.html
<html>
<head>
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'main/vis.css' %}" />
<script type="text/javascript" src="{% static 'main/vis.js' %}"></script>
<link href="{% static 'main/css/prism.css' %}" rel="stylesheet">
<link href="{% static 'main/css/ghpages-materialize.css' %}" type="text/css" rel="stylesheet" media="screen,projection">
<link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style type="text/css">
#mynetwork {
width: 100%;
height: 600px;
border: 1px solid lightgray;
}
</style>
</head>
</html>
<body>
<div>
<center>
<b> {{ real_seq }}<br>
<b>{{ repair_seq }}
</center>
</div>
</body>
Thanks for everybody who looking and helping to solve the problem.