【发布时间】:2019-03-13 14:58:10
【问题描述】:
我要加载的实际页面需要相当多的时间,因为它查询 API 以获取大量数据(python 正在执行后端查询)。如何渲染我的加载页面,然后在收集数据后渲染我的实际页面。
我在 view.py 中想要做什么
class Page(ListView):
def loading(request):
return render(request,'loading.html')
def viewProfile(request, player_name):
Page.loading(request)
context = {
'data1' : query_api(1),
'data2' : query_api(2),
'data3' : query_api(3),
}
return render(request, 'actualpage.html', context)
【问题讨论】:
标签: python django python-3.x django-templates