去南极看鲸鱼 2023-02-23 15:41 采纳率: 33.3%
浏览 40

AttributeError: module 'app' has no attribute 'rount

为啥我这个运行报错显示:AttributeError: module 'app' has no attribute 'rount',大lao们帮我瞅瞅。


# 登录验证
from flask import app, render_template, request, Flask

@app.rount("/")
def index():
    return render_template("login.html")


@app.route("/login", methods=['POST'])
def login():
    # 接收用户名和密码
    # {username:你写的内容 pwd:你写的内容}
    username = request.form.get("username")
    password = request.form.get("pwd")
    if username == "alex" and password == "123":
        return "成功"
    else:
        return "失败"


#login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form action="/login" method="POST">
        用户名 <input type="text" name="username" >
        密码 <input type="password" name="pwd" >
        <input type="submit" value="登录">
    </form>
</body>
</html>

  • 写回答

3条回答 默认 最新

  • _雪菜肉丝面_ 2023-02-23 15:47
    关注

    5行写错了,你看10行

    评论

报告相同问题?

问题事件

  • 创建了问题 2月23日