I have been using following approach:
# Custom static data
@app.route('/cdn/<path:filename>')
def custom_static(filename):
return send_from_directory(app.config['CUSTOM_STATIC_PATH'], filename)
The CUSTOM_STATIC_PATH
variable is defined in my configuration.
And in templates:
{{ url_for('custom_static', filename='foo') }}
Caveat emptor - I'm not really sure whether it's secure ;)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…