博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
消息提示
阅读量:4592 次
发布时间:2019-06-09

本文共 1016 字,大约阅读时间需要 3 分钟。

from flask import Flask, render_template, flash, requestapp = Flask(__name__)app.secret_key = "123456"@app.route("/")def hello_world():    flash("hello, mr bean")    return render_template("index.html")@app.route("/login", methods=["POST"])def login():    form = request.form    username = form.get("username")    password = form.get("password")    if not username:        flash("please input username")        return render_template("index.html")    if not password:        flash("please input password")        return render_template("index.html")    if username == "mr bean" and password == "123456":        flash("login success")        return render_template("index.html")    else:        flash("username or password is wrong")        return render_template("index.html")if __name__ == '__main__':    app.run(debug=True)#index.html    
欢迎登陆

welcome

{
{ get_flashed_messages()[0] }}

 

转载于:https://www.cnblogs.com/themost/p/8452789.html

你可能感兴趣的文章
POJ 2653
查看>>
余承东:未来5年中国大部分智能手机厂商消失
查看>>
Android中个人推崇的数据库使用方式
查看>>
关于H.264 x264 h264 AVC1
查看>>
北戴河之旅
查看>>
search for a range(找出一个数在数组中开始和结束位置)
查看>>
一次Mutex死锁的原因探究
查看>>
Notepad++ - 通过语言格式设置自定义语法高亮颜色
查看>>
日记(16)-20140928
查看>>
IIS的应用程序池优化方法
查看>>
HTML5 虚拟键盘出现挡住输入框的解决办法
查看>>
绿色astah简体中文版6.8
查看>>
(三)Installation
查看>>
函数_命名空间和作用域
查看>>
bash正则
查看>>
centos下设置nodejs开机启动
查看>>
Echarts Binning on map 根据真实经纬度渲染数据
查看>>
本地dubbo+zookeeper环境搭建
查看>>
【Oracle 触发器】(2)触发器的分类(语句级/行级)
查看>>
poj3254 状压dp 每行独立 入门水题
查看>>