随笔分类 -  FastAPI

摘要:# in查询 ```python db.query(UserAccount #模型名称).filter(account_type.in_(['1','2','3'])).all() ``` # array_agg 聚合查询 ```python db.query(func.min(UserAccoun 阅读全文
posted @ 2023-03-08 18:17 蒲公英PGY 阅读(590) 评论(0) 推荐(0) 编辑
摘要:配置文件 config-dev.ini # -*- coding: utf-8 -*- # 数据库配置 [pgsql] host=192.168.1.2 port=5432 dbname=test user=root passwd=xxxxxxxx # Redis配置 [redis] host=19 阅读全文
posted @ 2023-03-08 18:01 蒲公英PGY 阅读(962) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/python # -*- coding: utf-8 -*- # @time : 2023/2/3 15:21 # @author : pugongying # @description : 日志配置 # 获取日志目录 import logging import os from 阅读全文
posted @ 2023-03-08 17:46 蒲公英PGY 阅读(577) 评论(0) 推荐(0) 编辑
摘要:作用 用于所有表都需要使用的字段或者方法 实现代码 base.py #!/usr/bin/python # -*- coding: utf-8 -*- # @time : 2023/2/13 17:43 # @author : pugongying # @description : from sql 阅读全文
posted @ 2023-03-08 17:43 蒲公英PGY 阅读(277) 评论(0) 推荐(0) 编辑
摘要:作用 需要在应用程序启动之前或者关闭时进行,例如数据库迁移,定时任务····· 实际代码 main.py import uvicorn from app import create_app app = create_app() if __name__ == '__main__': uvicorn.r 阅读全文
posted @ 2023-03-08 17:31 蒲公英PGY 阅读(291) 评论(0) 推荐(0) 编辑
摘要:# python使用FastAPI返回简单html页面 ```python # pip install uvicorn prometheus_client # pip install fastapi yaml # uvicorn main:app --reload from fastapi impo 阅读全文
posted @ 2022-06-07 11:16 蒲公英PGY 阅读(1290) 评论(0) 推荐(0) 编辑
摘要:# python 调用dingding的API进行消息发送 使用python的fastapi快速构建后端api接口 ```python # pip install fastapi requests uvicorn from typing import Set from fastapi import 阅读全文
posted @ 2022-06-07 11:11 蒲公英PGY 阅读(295) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示