Flask动态切换选项并通过Fetch查询显示

Flask-WTF 提供了WTForms的功能集成,使用该模块能快捷创建表单页面,包含有 Flask 和 WTForms, 集成了 CSRF, file upload 以及 reCAPTCHA.。目前版本为0.14.3,使用说明文档在 https://flask-wtf.readthedocs.io/en/stable/ 。 具体功能如下: 集成 wtforms。 带有 csrf 令牌的安全表单。 全局的 csrf 保护。 支持验证码(Recaptcha)
Read more →

Sqlalchemy中Query的方法汇总

SQLAlchemy 是flask中必备的库,能操作各种关系数据库。数据库映射的方法在 廖雪峰 的官方网站上有具体例子。本文主要是记录一下SQLAlchemy通过 session 对象执行查询的各种 query 方法。 遍历 for user in session.query(User).order_by(User.id): print(user.name, user.fullname) 执行结果: ed Ed Jones wendy Wendy Williams mary Mary Contrary fred Fred Flinstone 或者: for name, fullname in session.query(User.name, User.fullname): print(name, fullname) # 执行结果: ed Ed Jones wendy Wendy Williams mary Mary Contrary fred Fred Flinstone 再看一
Read more →

用Flask建立一个简单的Web App

SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.It provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language. 网上的很多教程和视频都是基于本地SQLite数据库进行的操作,因为我个人的项目是在MSSQL上的,所以这里对Flask使用MS SQL Server的方法进行记录。 目标: MSSQL数据库存储数据 有
Read more →

在Flask中使用SQLAlchemy操作数据的方法

1 简介 SQLAlchemy 是一个使用 Python 实现的 ORM 框架,它的设计理念是:SQL 数据库的量级和性能比对象集合重要,对象集合的抽象比表和行重要;它采用了类似于 Java 里 Hibernate 的数据映射模型;它的目标是提供能兼容众多数据库(如:SQLite、MySQL、Postgres、Oracle、MS-SQL、SQLServer
Read more →