【发布时间】:2016-02-09 22:40:23
【问题描述】:
我正在使用 Flask 应用程序并且遇到了一些路由问题。
以下函数可以正常工作(如预期的那样呈现模板):
@app.route('/page1', methods = ['POST'])
def page1():
...
return render_template('page1.html')
然而,几乎相同的功能
@app.route('/page1/', methods = ['POST'])
def page1():
...
return render_template('page1.html')
不再能够加载与page1.html 关联的任何 css 资源。 html 加载顺利,只是找不到其他资源。
如果有人对为什么额外的尾部斜杠会导致这种情况有所了解,那就太好了!
【问题讨论】:
-
请分享模板。