views.py 文件源码

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

项目:esdc-shipment 作者: erigones 项目源码 文件源码
def get_image_file(uuid, image_file_path):
    """GetImageFile (GET /images/:uuid/file)

    Return the image file.
    """
    encoded_md5 = get_image_file_md5(uuid, image_file_path)

    if NGINX_ENABLED:
        res = make_response('')
        res.headers['Content-Type'] = 'application/octet-stream'
        res.headers['X-Accel-Redirect'] = '/static/images/%s/file?md5=%s' % (uuid, encoded_md5)
    else:
        res = make_response(send_file(image_file_path, add_etags=False, cache_timeout=0))

    res.headers['Content-Length'] = get_image_file_size(image_file_path)
    res.headers['Content-MD5'] = encoded_md5

    return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号