python类send_from_directory()的实例源码

branches.py 文件源码 项目:BookCloud 作者: livro-aberto 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pdf(project, branch='master'):
    build_path = os.path.abspath(join('repos', project.name, branch.name,
                                      'build/latex'))
    build_latex(project.name, branch.name)
    command = '(cd ' + build_path + '; pdflatex -interaction nonstopmode linux.tex > /tmp/222 || true)'
    os.system(command)
    return flask.send_from_directory(build_path, 'linux.pdf')
branches.py 文件源码 项目:BookCloud 作者: livro-aberto 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def tex(project, branch='master'):
    build_path = os.path.abspath(join('repos', project.name, branch.name,
                                      'build/latex'))
    build_latex(project.name, branch.name)
    return flask.send_from_directory(build_path, 'linux.tex')
branches.py 文件源码 项目:BookCloud 作者: livro-aberto 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def source(project, branch, filename):
    source_path = os.path.abspath(join('repos', project.name, branch.name, 'source'))
    return flask.send_from_directory(source_path, filename)
branches.py 文件源码 项目:BookCloud 作者: livro-aberto 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def get_tikz(project, branch, action, filename):
    images_path = join('repos', project.name, branch.name,
                       'build/html/_images')
    response = send_from_directory(os.path.abspath(images_path), filename)
    if '/_images/tikz-' in request.url:
        response.cache_control.max_age = 5256000
    return response
projects.py 文件源码 项目:BookCloud 作者: livro-aberto 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def resources(project, filename):
    return send_from_directory(
        os.path.abspath(join(project.get_folder(), '_resources/original')),
        filename)
web.py 文件源码 项目:PYKE 作者: muddyfish 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def send_js(path):
    return send_from_directory('web_content/static', path)
server.py 文件源码 项目:SnapStitch 作者: avikj 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def results(filename):
    if not os.path.isfile(os.path.join('results', 'finished_'+filename[:filename.rindex('.')]+'.txt')):
        abort(404)
        return
    return send_from_directory('results',filename)
webui.py 文件源码 项目:headers 作者: oshp 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def service_worker():
    return send_from_directory('static/', 'service-worker.js')
uploads.py 文件源码 项目:FRG-Crowdsourcing 作者: 97amarnathk 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def uploaded_file(filename):  # pragma: no cover
    """Return uploaded file."""
    return send_from_directory(uploader.upload_folder, filename)
main.py 文件源码 项目:Paper-Melody.server 作者: gigaflw 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def download_avatar(fname):
    if platform.system() == "Windows":
        path = UPLOAD_AVATAR_FOLDER + "/" + fname   # windows??????????????????????
    else:
        path = os.path.join(UPLOAD_AVATAR_FOLDER, fname)  # ?????
    if os.path.isfile(path):
        return send_from_directory(UPLOAD_AVATAR_FOLDER, fname, as_attachment=True)
    abort(404)
main.py 文件源码 项目:Paper-Melody.server 作者: gigaflw 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def download_music(fname):
    if platform.system() == "Windows":
        path = UPLOAD_FOLDER + "/" + fname   # windows??????????????????????
    else:
        path = os.path.join(UPLOAD_FOLDER, fname)  # ?????
    if os.path.isfile(path):
        return send_from_directory(UPLOAD_FOLDER, fname, as_attachment=True)
    abort(404)
main.py 文件源码 项目:Paper-Melody.server 作者: gigaflw 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def get_image(img_name):
    if platform.system() == "Windows":
        path = UPLOAD_IMAGE_FOLDER + "/" + img_name   # windows??????????????????????
    else:
        path = os.path.join(UPLOAD_IMAGE_FOLDER, img_name)  # ?????
    if os.path.isfile(path):
        return send_from_directory(UPLOAD_IMAGE_FOLDER, img_name, as_attachment=True)
    abort(404)
app.py 文件源码 项目:pokedex-as-it-should-be 作者: leotok 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def uploaded_file(filename):
    return send_from_directory(FULL_UPLOAD_PATH, filename)
app.py 文件源码 项目:pokedex-as-it-should-be 作者: leotok 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def send_static(path):
    return send_from_directory('static', path)
server.py 文件源码 项目:vqa-mcb 作者: akirafukui 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_visualization(filename):
    return send_from_directory(VIZ_FOLDER, filename)
app.py 文件源码 项目:posm-imagery-api 作者: mojodna 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_mbtiles(id):
    return send_from_directory(
        IMAGERY_PATH,
        os.path.join(id, 'index.mbtiles'),
        as_attachment=True,
        attachment_filename='{}.mbtiles'.format(id),
        conditional=True
    )


# TODO allow bounding boxes + zoom ranges to be provided
server.py 文件源码 项目:pheweb 作者: statgen 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def api_pheno(phenocode):
    return send_from_directory(common_filepaths['manhattan'](''), phenocode)
server.py 文件源码 项目:pheweb 作者: statgen 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def api_pheno_qq(phenocode):
    return send_from_directory(common_filepaths['qq'](''), phenocode)
api.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def web_remote_file():
    remote_path = request.args.get('path')
    if not remote_path:
        return "No remote path given."
    local_path, name = get_remote_file(remote_path)
    if not local_path:
        return "Remote file '{}' not found.".format(remote_path)
    res = send_from_directory(local_path, name, as_attachment=True)
    shutil.rmtree(local_path)
    return res

# ########################################################################### #
#                                API Part                                     #
# ########################################################################### #
__init__.py 文件源码 项目:quokka_ng 作者: rochacbruno 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def template_files(filename):
    template_path = os.path.join(current_app.root_path,
                                 current_app.template_folder)
    return send_from_directory(template_path, filename)


问题


面经


文章

微信
公众号

扫码关注公众号