捆绑不工作

bundling not working

我是 Flask 的新手 angularjs。我正在尝试根据提供的说明使用 bundle(assets) here.

我已经安装了所需的 jsmin 并相应地在 html 部分调用我的过滤器 {% assets "common_js" %} <script src="{{ ASSET_URL }}"></script> {% endassets %}

此处 common_js 包已声明并注册。

from flask.ext.assets import Environment, Bundle
common_js = Bundle("datepicker.js",filters='jsmin', output='output.js')
assets_env.register('common_js',common_js)

我在服务器端看到的输出是 INFO 2015-06-30 02:18:44,606 module.py:790] default: "GET /%7B%7B%20ASSET_URL%20%7D%7D HTTP/1.1" 404 2322 谁能指出我缺少的东西吗?任何帮助表示赞赏。 谢谢

您正在打开模板文件,但没有渲染它。

@app.route('/')
def index():
    return render_template('index.html')

更新

渲染模板时,您只需要它相对于您的模板文件夹的路径。您不需要像使用 open 读取文件时那样需要相对于工作目录的路径。