zoukankan      html  css  js  c++  java
  • 前后端分离实现django日志下载,celery日志下载

    djang后台:

    # django日志下载接口
    def django_journal_load(request):
        print BASE_DIR
        file = open(BASE_DIR + 'logsdjango.log', 'rb')
        response = StreamingHttpResponse(file.read())
        response['Content-Type'] = 'application/octet-stream'
        response['Content-Disposition'] = 'attachment;filename="{0}"'.format('django.log')
        return response
    
    
    # celery日志下载接口
    def celery_journal_load(request):
        file = open(os.getcwd() + '\..\task_centercelery.log', 'rb')
        response = StreamingHttpResponse(file.read())
        response['Content-Type'] = 'application/octet-stream'
        response['Content-Disposition'] = 'attachment;filename="{0}"'.format('celery.log')
        return response

    html前端:

    <dd><a href="" id="django_log">Django日志下载</a></dd>
    <dd><a href="" id="celery_log">Celery日志下载</a></dd>

    js

        var django_l=ip_number+"Django_journal_load";
        $("#django_log").attr("href",django_l);
        var celery_l=ip_number+"Celery_journal_load";
        $("#celery_log").attr("href",celery_l);
  • 相关阅读:
    DOSD用scratch的方式训练通用目标检测,性能很高
    caffemodel模型
    NetScope脱机(localhost)使用[转】
    class前置声明
    const函数
    CUDA开发
    caffe2学习
    faster rcnn讲解很细
    控制台输出覆盖当前行显示
    UA池 代理IP池 scrapy的下载中间件
  • 原文地址:https://www.cnblogs.com/qxh-beijing2016/p/12131830.html
Copyright © 2011-2022 走看看