Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django:如何多次呈现/刷新网页_Python_Django_Selenium - Fatal编程技术网

Python Django:如何多次呈现/刷新网页

Python Django:如何多次呈现/刷新网页,python,django,selenium,Python,Django,Selenium,我不确定如何在一次执行期间多次呈现/刷新页面 示例:我正在后台运行selenium测试,希望在每次运行后更新页面 每个测试都会返回一些数据,并且它们分别工作得很好 def runtest1(request): title = Task.objects.get(test_name='runtest1').title test_result = calculate_words(title) update_tests('runtest1', test_result) r

我不确定如何在一次执行期间多次呈现/刷新页面

示例:我正在后台运行selenium测试,希望在每次运行后更新页面

每个测试都会返回一些数据,并且它们分别工作得很好

def runtest1(request):
    title = Task.objects.get(test_name='runtest1').title
    test_result = calculate_words(title)
    update_tests('runtest1', test_result)
    return test_result


def runtest2(request):
    title = Task.objects.get(test_name='runtest2').title
    test_result = test_links(title)
    update_tests('runtest2', test_result)
    return test_result

然后渲染

def index(request):
    tasks = Task.objects.all()
    test_result = TestResult('', '', '')

    if request.GET.get('runtest1'):
        test_result = runtest1(request)

    if request.GET.get('runtest2'):
        test_result = runtest2(request)

    context = {'tasks': tasks, 'test_result': test_result}
    return render(request, 'tasks/list.html', context)
我想在一次运行中运行所有这些测试,并在每次测试后更新页面

大概是这样的:

def run_all(request):
    runtest1(request)
    runtest2(request)
    return runtest3(request)
你能帮我解决这个问题吗