Binary file download

我的未来我决定 提交于 2019-12-30 18:31:14

问题


I'm building a server using python and bottle.

How can I handle a request for a binary file?

I have read that I should use flask. There is a way for doing that without using flask?


回答1:


Yes, you should use static_file function:

from bottle import static_file    

@route('/download/<filename:path>')
def download(filename):
    return static_file(filename, root='/path/to/static/files', download=filename)


来源:https://stackoverflow.com/questions/13725417/binary-file-download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!