我正在使用python和bottle构建服务器。
如何处理二进制文件的请求?
我读过我应该用烧瓶。 有没有办法在不使用烧瓶的情况下这样做?
是的,你应该使用static_file
函数:
from bottle import static_file
@route('/download/<filename:path>')
def download(filename):
return static_file(filename, root='/path/to/static/files', download=filename)