会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
刘宏缔的架构森林
专注架构的博客
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
221
下一页
2026年11月5日
fastapi: 用ua_parser解析user_agent
摘要: 一,安装用到的库: % pip install ua_parser 二,代码 工具函数 from ua_parser import parse as my_parse # 解析user-agent,得到os和browser def parse_ua(user_agent: str) -> tuple
阅读全文
posted @ 2026-11-05 20:08 刘宏缔的架构森林
阅读(7)
评论(0)
推荐(0)
2026年11月3日
git: 去掉提交代码前的hook
摘要: 一,查看已添加的hook % git commit -m "增加了系统管理和运维管理的一些功能"; ╭──────────────────────────────────────────╮ │ 🥊 lefthook v2.1.14 hook: commit-msg │ ╰─────────────
阅读全文
posted @ 2026-11-03 23:14 刘宏缔的架构森林
阅读(11)
评论(0)
推荐(0)
fastapi: 用ip2region项目实现根据IP地址查询得到省市信息
摘要: 一,库的地址及安装 地址: https://github.com/lionsoul2014/ip2region 安装库 % pip install py-ip2region 安装数据: 下载ip2region_v4.xdb这个文件到项目的根目录下 二,代码 import ip2region.sear
阅读全文
posted @ 2026-11-03 22:35 刘宏缔的架构森林
阅读(26)
评论(0)
推荐(0)
fastapi: 得到redis的状态数据:
摘要: 一,代码: """前台个人资料。""" from fastapi import APIRouter, Depends, Request from typing import Annotated from app.core.deps import get_current_app_user from a
阅读全文
posted @ 2026-11-03 22:07 刘宏缔的架构森林
阅读(7)
评论(0)
推荐(0)
2026年11月1日
fastapi: 在middleware中记录操作日志
摘要: 一,说明: 1, 在 FastAPI 中,可以直接在 Middleware 中执行 BackgroundTask,但需要通过手动修改或附加到 Starlette 的 Response.background 属性来实现, 而不能像在路由函数中那样通过依赖注入(DI)直接注入 BackgroundTas
阅读全文
posted @ 2026-11-01 21:34 刘宏缔的架构森林
阅读(11)
评论(0)
推荐(0)
fastapi:父子应用的项目中如何获取router列表
摘要: 一,说明 include_router(auth_router)之后,admin_app.routes 中保存的是 _IncludedRouter,不再立即展开成 APIRoute。 建议的做法: 建议不要把 _IncludedRouter 作为长期依赖,它的名字以下划线开头,属于内部实现。更稳定的
阅读全文
posted @ 2026-11-01 19:15 刘宏缔的架构森林
阅读(15)
评论(0)
推荐(0)
fastapi: 有多个middleware时的执行顺序
摘要: 一,说明 在 FastAPI(基于 Starlette)中,当存在多个中间件(Middleware)时,它们的执行顺序遵循一个非常核心的原则:“先进后出” 的洋葱模型(On Onion Model)。 注册顺序与执行顺序 请求阶段(Request): 按照 add_middleware 相反的顺序(
阅读全文
posted @ 2026-11-01 14:57 刘宏缔的架构森林
阅读(10)
评论(0)
推荐(0)
2026年10月31日
vben admin: 在页面上使用图标
摘要: 一,引入图标 官方文档: https://doc.vben.pro/guide/essentials/icons.html 编辑 packages/icons/src/iconify/index.ts,添加上需要的icon,如下: import { createIconifyIcon } from
阅读全文
posted @ 2026-10-31 16:02 刘宏缔的架构森林
阅读(14)
评论(0)
推荐(0)
2026年10月28日
vben admin: 从网络接口获取数据
摘要: 一,代码 api import { requestClient } from '#/api/request'; // 或者根据你的别名配置从指定的封装路径引入 export interface RoleItem { id: number; name: string; } //分页用的数据 expor
阅读全文
posted @ 2026-10-28 15:17 刘宏缔的架构森林
阅读(11)
评论(0)
推荐(0)
vben admin: el-table不能显示数据
摘要: 一,问题: 页面上添加的el-table不显示数据:如下: <ElTable :data="roleList" height="100%" stripe > <ElTableColumn label="角色名字" min-width="140" prop="name" show-overflow-t
阅读全文
posted @ 2026-10-28 13:22 刘宏缔的架构森林
阅读(10)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
221
下一页
公告