【发布时间】:2021-06-04 02:59:16
【问题描述】:
有谁知道我为什么使用烧瓶并输入 URL:127.0.0.1/testpge 到 chrome,错误总是显示:AssertionError( AssertionError: View function mapping is overwriting an existing endpoint function: conpab 127.0.0.1.。我的代码在下面:
from flask import *
app=Flask(__name__, template_folder="C:\\Users\\Administrator\\")
@app.route("/testpge", endpoint='testpge')
def pagee(name):
con=100090909
if con < 10 :
@app.route("/conpa", endpoint='conpa')
def conpa():
return "Conpa page is 000"
elif con > 10 :
@app.route("/conpab", endpoint='conpab')
def conpab():
return "Conpa page is very big !"
return "Test page 000"
if __name__ =="__main__" :
app.run(host="127.0.0.1",port="80")
【问题讨论】:
-
你为什么要把路线放在现有路线中?
-
我要判断条件。
-
我可以重定向自己的视图函数吗,像这样,返回redirect(url_for("testpge"))??