我一直在使用以下方法:
# Custom static data@app.route('/cdn/<path:filename>')def custom_static(filename): return send_from_directory(app.config['CUSTOM_STATIC_PATH'], filename)该
CUSTOM_STATIC_PATH变量在我的配置中定义。
在模板中:
{{ url_for('custom_static', filename='foo') }}买者自负 -我不确定这是否安全;)



