• 最简单的flask表单登录


    from flask import Flask
    from flask import request
    
    app = Flask(__name__)
    
    @app.route('/', methods=['GET', 'POST'])
    def home():
        return '<h1>Hello World!</h1><a href="http://127.0.0.1:5000/signin">登录</a>'
    
    @app.route('/signin', methods=['GET'])
    def signin_form():
        return '''<form action="/signin" method="post">
                      <p><input name="username"></p>
                      <p><input name="password" type="password"></p>
                      <p><button type="submit">Sign In</button></p>
                      </form>'''
    @app.route('/signin', methods=['POST'])
    def signin():
        if request.form['username']=='admin' and request.form['password']=='password':
            return '<h2>hello,admin</h2>'
        return '<h2>bad username or password</h2>'
    
    if __name__ == '__main__':
        app.run()
  • 相关阅读:
    模糊匹配
    UPDATE SET FROM WHERE 续
    SQL SERVER 中row_number用法
    临时表和表变量
    镜像
    经典行列转换
    表记录查询最快查询方式
    NULL不是数值
    自增长值
    JSON
  • 原文地址:https://www.cnblogs.com/ncuhwxiong/p/8182626.html
Copyright © 2020-2023  润新知