Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何将按钮重定向到flask中的根url?_Python 3.x_Web_Flask - Fatal编程技术网

Python 3.x 如何将按钮重定向到flask中的根url?

Python 3.x 如何将按钮重定向到flask中的根url?,python-3.x,web,flask,Python 3.x,Web,Flask,在我的flaskPage.py文件中有上述函数,我想创建一个从下面显示的返回主页按钮到上述根url的链接。但是,的url_不接受空字符串作为参数,并抛出如下错误 @app.route("/") def index(): return render_template("webpage.html") 提前感谢。 Could not build url for endpoint '' 回家 这就解决了问题 Could not build url for endpoint '' <

在我的flaskPage.py文件中有上述函数,我想创建一个从下面显示的返回主页按钮到上述根url的链接。但是,的url_不接受空字符串作为参数,并抛出如下错误

@app.route("/")
def index():
    return render_template("webpage.html")
提前感谢。


Could not build url for endpoint ''
回家
这就解决了问题

Could not build url for endpoint ''
<form method="get" action="{{url_for('index')}}">
<button> Back to Home </button>
</form>