@[TOC](werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.KeyError: ‘username’)
现象
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError: ‘username’
原因
服务器不理解请求的语法。对着w3cschool上学习flask,比对了程序一样的,网上查了下关于html的资料。在form中没有定义username,原来form表单,会将它的输入框中的值,绑定到’name’属性中,后端取值的时候也是根据‘name’属性的值去取值。
解决方法
修改login.html文件的改为