上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 214 下一页
摘要: 一,报错: ERROR [flask_migrate] Error: Multiple heads are present; please specify a single target revision 完整的报错信息: $ flask db stamp head /data/python/fla 阅读全文
posted @ 2026-06-18 10:07 刘宏缔的架构森林 阅读(8) 评论(0) 推荐(0)
摘要: 一,报错信息 File "/data/python/flask/panda-sys/venv/lib/python3.10/site-packages/alembic/script/revision.py", line 768, in _resolve_revision_number self._r 阅读全文
posted @ 2026-06-18 10:06 刘宏缔的架构森林 阅读(8) 评论(0) 推荐(0)
摘要: 一,报错信息 报错代码 from passlib.context import CryptContext # 密码哈希上下文 pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") # 工具函数 def verify_pas 阅读全文
posted @ 2026-06-12 10:54 刘宏缔的架构森林 阅读(117) 评论(0) 推荐(0)
摘要: 一,报错信息: /data/python/fastapi/demo1/venv/lib/python3.10/site-packages/jwt/api_jwt.py:368: InsecureKeyLengthWarning: The HMAC key is 31 bytes long, whic 阅读全文
posted @ 2026-06-12 10:54 刘宏缔的架构森林 阅读(50) 评论(0) 推荐(0)
摘要: 一,代码 import hashlib from datetime import datetime, timedelta, timezone from typing import Optional from fastapi import FastAPI, Depends, HTTPException 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(10) 评论(0) 推荐(0)
摘要: 一,安装用到的第三方库 $ pip install redis 说明: redis库和aioredis库两者有什么区别? 这是一个非常经典的“历史遗留”问题。其实在今天,它们已经没有区别了,因为它们已经合并成了同一个库。 简单来说:aioredis 已经被合并到了官方的 redis 库中。 二,代码 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(39) 评论(0) 推荐(0)
摘要: 一,安装用到的库 在 FastAPI 中,使用 JWT(JSON Web Token)进行身份验证时,现在官方和社区最推荐、使用率最高的组合是: PyJWT:负责生成(Encode)和解析(Decode)JWT 字符串。 passlib[bcrypt]:负责对用户密码进行哈希加盐存储和验证。 Fas 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(20) 评论(0) 推荐(0)
摘要: 一,代码: # app/api/products.py import math from fastapi import APIRouter, Request, Depends, HTTPException, Form from pydantic import BaseModel, Field fro 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(10) 评论(0) 推荐(0)
摘要: 一,添加数据 代码: # app/api/products.py from fastapi import APIRouter, Request, Depends, HTTPException, Form from pydantic import BaseModel, Field from app.c 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(13) 评论(0) 推荐(0)
摘要: 一,报错信息: sqlalchemy.exc.StatementError: (builtins.ValueError) Value 123 is not None, True, or False 二,原因: 这个报错的根本原因在于:你把数据库中某个定义为布尔类型(Boolean / BOOL)的字 阅读全文
posted @ 2026-06-12 10:53 刘宏缔的架构森林 阅读(15) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 214 下一页