我正在努力建立一个网站,而现在我只想确保我可以让基本的部分工作。
当我单击索引页上的链接,该链接会将我重定向到我的测试页时,会出现404未找到错误。
我已经做了一系列的搜索,试图找出如何解决我的问题,但没有任何工作。有一个问题看起来应该是我的问题的确切解决方法
404 Error when trying to link to another page flask
,但在尝试将test_link.html中的“我的Href”更改为与flaskapp.py中的路由匹配,或尝试test_link.html中的“URL”后,我仍然收到错误。我不知道还能试什么。
任何帮助都将不胜感激。
烧瓶app.py
from flask import Flask, jsonify, redirect, render_template, request,
url_for
# Configure application
app = Flask(__name__)
@app.route("/")
def get_index():
return render_template('index.html')
app.route("/test_link")
def test_link():
return render_template('test_link.html')
if __name__ == "__main__":
app.run(debug=True)
index.html索引
helloIndex Page
This is a test link
测试链接.html
hellotest link