Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 python 和瓶子构建服务器。
如何处理对二进制文件的请求?
我读过我应该使用烧瓶。有一种方法可以在不使用烧瓶的情况下做到这一点吗?
是的,你应该使用static_file功能:
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)