本地Flask实例中有多个静态路径 [英] More than one static path in local Flask instance
问题描述
是否可以为我的本地开发人员Flask实例添加更多的静态路径?
我希望有默认的 static
文件夹来存储站点和另一个文件夹的js / css / images文件。 设计
以保留我的特定资产。如果存在更好的解决方案,我不希望在 static
中放置 designs 文件夹。
我一直在使用以下的方法:
$ p $ #自定义静态数据
@ app.route('/ cdn /< path:filename>')
def custom_static(filename):
return send_from_directory(app.config ['CUSTOM_STATIC_PATH' ],filename)
在模板中: em> - 我不确定是否安全;) Is that possible to add more static paths for my local dev Flask instance?
I want to have default I have been using following approach: The And in templates: Caveat emptor - I'm not really sure whether it's secure ;) 这篇关于本地Flask实例中有多个静态路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
static
folder for storing js/css/images files for the site and another folder, e.g. designs
to keep my specific assets. I don't want to place designs
folder inside static
if there is a better solution exists.# 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
variable is defined in my configuration.{{ url_for('custom_static', filename='foo') }}