希望我问的是正确的问题:
我最近开发了一个竞赛评分应用程序,最终我想学习如何为它创建websocket(我认为这是个好主意,不是吗?),但现在它的工作原理如下。用户将分数输入表格中,表格将提交到页面,django在该页面获取信息并将其添加到数据库中,如下所示:
#Every time a form is submitted it goes through this
#get results from the post
number_of_judges = 15
judge = request.POST.get("judge")
round = request.POST.get("round")
pk = request.POST.get("pk")
event = request.POST.get("event")
cat1 = float(request.POST.get("cat1")) * 5
cat2 = float(request.POST.get("cat2"))* .5
cat3 = float(request.POST.get("cat3"))*2.5
cat4 = float(request.POST.get("cat4"))
cat5 = float(request.POST.get("cat5"))*1.5
total = sum([cat1, cat2, cat3, cat4, cat5])
if round == "R1":
inst = firstround_1.objects.get(pk =int(pk))
scoring = score.objects.create(person = inst, judge = judge, cat1 = cat1, cat2 = cat2, cat3 = cat3, cat4 = cat4, cat5 = cat5, total = total, event = event) #this is here so i can go back and look at individual entries
inst.score = float(inst.score) + ( total / number_of_judges )
inst.Entry = inst.Entry + 1 #I put this here to track how many judges that submitted
inst.save()
我遇到的问题是,有些是延迟,有些是重复出现的,有些似乎甚至没有进入人员分数的最终计算。平均有15人在输入,我使用的是python django 1.6.5
这可能是wifi问题吗(我正在与流媒体服务共享wifi)
有哪些方法可以防止这些问题?
后来我把应用程序移到了heroku,这样我就可以增加dynos之类的功能,这真的会有帮助吗
目前没有回答
相关问题 更多 >
编程相关推荐