views.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:dao_manage 作者: houziyu 项目源码 文件源码
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]})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号