我想做这样的事情:
app = Flask(__name__)
app.config.from_object(mypackage.config)
app.static_url_path = app.config['PREFIX']+"/static"
Run Code Online (Sandbox Code Playgroud)
当我尝试:
print app.static_url_path
Run Code Online (Sandbox Code Playgroud)
我明白了 static_url_path
但是在我使用的模板中url_for('static'),使用jinja2生成的html文件仍然具有默认的静态URL路径/static,缺少PREFIX我添加的路径.
如果我像这样硬编码路径:
app = Flask(__name__, static_url_path='PREFIX/static')
Run Code Online (Sandbox Code Playgroud)
它工作正常.我究竟做错了什么?
flask ×1