def html_page(request):
service_name = request.GET.get('service_name')
log_path = dao_config.log_dir_master
service_name_path = log_path + service_name
all_file = []
for i in os.listdir(service_name_path):
file_path = service_name_path +'/' + i
if os.path.isfile(file_path):
all_file.append([i,file_path])
print(all_file)
all_file = sorted(all_file, key=lambda file_name: file_name[1])
paginator = Paginator(all_file, 10) # Show 25 contacts per page
page = request.GET.get('page')
try:
contacts = paginator.page(page)
except PageNotAnInteger:
contacts = paginator.page(1)
except EmptyPage:
contacts = paginator.page(paginator.num_pages)
return render(request, 'cat_down_log.html', {"contacts": contacts,'service_name':[service_name]})
评论列表
文章目录