小编use*_*861的帖子

Python烧瓶获得404未找到错误

我正在使用Flask设计这个简单的网站.但我的hello方法遇到404错误.每当我点击"评价艺术家"按钮时,它都会给我错误,但home.html,hello.html和artist.html的模板都是正确的.我不知道我的代码的哪一部分是错的.有帮助吗?

@app.route("/",methods=['GET','POST'])
def login():
    if request.method=="GET":
        return render_template("home.html")
    if request.method=="POST":
        if (request.form["button"]=="login"):
            return render_template("hello.html",name=request.form["name"])

@app.route("/hello",methods=['GET','POST'])
def hello():
    if request.method=="GET":
        if(request.form["button"]=="rate artists"):
            return render_template("artist.html")
Run Code Online (Sandbox Code Playgroud)

python flask http-status-code-404

2
推荐指数
1
解决办法
7430
查看次数

标签 统计

flask ×1

http-status-code-404 ×1

python ×1