摘要: 简介 WTForms是一个支持多个web框架的form组件,主要用于对用户请求数据进行验证。 安装: 1. 用户登录 当用户登录时候,需要对用户提交的用户名和密码进行多种格式校验。如: 用户不能为空;用户长度必须大于6; 用户不能为空;用户长度必须大于6; 密码不能为空;密码长度必须大于12;密码必 阅读全文
posted @ 2018-03-28 19:06 选择远方,风雨兼程。 阅读(361) 评论(0) 推荐(0) 编辑
摘要: from flask import Flask,current_app,globals,_app_ctx_stack app1 = Flask('app01') app1.debug = False # 用户/密码/邮箱 # app_ctx = AppContext(self): # app_ctx.app # app_ctx.g app2 = Flask('app02') app2.deb... 阅读全文
posted @ 2018-03-28 16:53 选择远方,风雨兼程。 阅读(583) 评论(0) 推荐(0) 编辑
摘要: class Foo(object): def func(self): print("func") pass def __enter__(self): print("enter") return Foo() def __exit__(self, exc_type, exc_val, exc_tb): ... 阅读全文
posted @ 2018-03-28 16:45 选择远方,风雨兼程。 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Flask框架中的信号基于blinker,其主要就是让开发者可是在flask请求过程中定制一些用户行为。 1. 内置信号 2. 源码示例 class Flask(_PackageBoundObject): def full_dispatch_request(self): self.try_trigg 阅读全文
posted @ 2018-03-28 16:23 选择远方,风雨兼程。 阅读(1122) 评论(0) 推荐(0) 编辑