当我打字时/login
作为url,会出错
例如:
from flask import Flask ,url_for,render_template,request
app = Flask(__name__)
@app.route('/login')
def index():
return "index"
if __name__== "__main__":
app.run()
错误结果是这样的:
Not Found.
The requested URL was not found on the server.
当我更换时/login
with /login/
或任何其他词,如/log
,会没事的。这是怎么发生的?
请阅读烧瓶快速入门 http://flask.pocoo.org/docs/quickstart/ 独特的 URL/重定向行为, URL规范化 http://en.wikipedia.org/wiki/URL_normalization and URL 中的尾部斜杠 - 首选哪种样式? https://stackoverflow.com/questions/5948659/trailing-slash-in-urls-which-style-is-preferred
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)