![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
flask
王大傻0928
这个作者很懒,什么都没留下…
展开
-
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129) --- 已解决
使用flask发送邮件的时候,报ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)错误;且浏览器返回:Internal Server ErrorThe server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an er原创 2022-05-01 17:51:43 · 4745 阅读 · 0 评论 -
flask--蓝图的使用
flask中蓝图的作用就是让Flask项目更加模块化,结构更加清晰,方便管理。如果将所有的视图函数都是写在同一个文件,项目比较大的话,这显然不是一个合理的结构。如图所示:from flask import Flaskapp = Flask(__name__)@app.route('/')def hello_world(): # put application's code here return 'Hello World!'@app.route('/uesr/list')de原创 2022-05-01 16:38:48 · 648 阅读 · 0 评论 -
wtforms表单验证
wtforms表单的两个主要功能是验证用户提交数据的合法性以及渲染模板。安装wtforms的命令为:pip install wtforms。如下是表单来做数据验证:import wtformsfrom wtforms.validators import length, emailclass LoginForm(wtforms.Form): username = wtforms.StringField(validators=[email(), length(min=6, max=20)])原创 2022-04-28 22:08:08 · 1211 阅读 · 0 评论 -
flask中使用cookie和session
1、在flask中设置cookie,是通过response对象来操作,可以在response返回之前,通过response.set_cookie()来设置。@app.route('/set_cookie')def set_cookie(): response = Response('设置cookie') response.set_cookie('userId', '2022042801') return response2、在flask中获取cookie,是通过request原创 2022-04-28 21:06:43 · 1957 阅读 · 0 评论