【发布时间】:2016-12-02 21:49:19
【问题描述】:
当文件位于文件系统根目录中时,如何使文件在瓶中可供下载。例如,在 ubuntu 操作系统的“媒体”目录中?
蟒蛇:
#bottle 0.12.10
@route('/download/<filename:path>')
def staticdownloadfile(filename):
return bottle.static_file(filename, root='/media', download=filename)
html:
<a href="/static/media/somefile.extension">download here</a>
上述方法行不通? 404 未找到。
【问题讨论】:
标签: python html download bottle