flask - 使用发送将引导按钮链接到 Flask 中的 url
问题描述
我的代码是这样的
@app.route("/mcap_format/<mcformat>")
def mcap_format(mcformat):
return send_from_directory(app.config["mcap_format_loc"],filename=mcformat,as_attachment=False)
当我打开时,这很好用。/mcap_format/mcformat ,文件被下载。但是,当我将其链接到按钮时,它会失败。
html代码在这里
<div class = "col-md-3">
<button type="button" id = "cmap_download" onclick = "window.location.href= '{{ url_for('/mcap_format',filename = 'mc1.xlsx')}}';" data-toggle="button" class="btn btn-primary btn-sm" >Downlaod the format<!/button>
</div>
它不工作的任何原因?
解决方案
推荐阅读
- javascript - 如何 - Photoshop 脚本 - 合并两个图层
- r - 获得与 ifelse 函数的错误关联
- google-drive-api - 将图像发布到 Google Drive API V3 时出现问题
- javascript - 如何从 Angular 7 中的另一个组件更新视图?
- jenkins - 为什么 'with' 方法在 Jenkins 管道中不起作用?
- python - 类型错误:+ 不支持的操作数类型:'float' 和 'instancemethod'
- jakarta-ee - 如何检测 SessionContext.setRollbackOnly 已在 EJB 的方法中被调用?
- javascript - 在 forEach 循环中调用服务并等待它完成后再继续
- java - 如何使用 Java 找到一年中 # 月的所有周数?
- python - 在 Flake8 3.7.x 中忽略 F403 规则也会忽略 E402 规则