上一页 1 2 3 4 5 6 ··· 200 下一页
摘要: 一,代码 # es分页搜索,通过关健词列表 def es_topic_search_by_list(qk_list): should_list = [] for qk in qk_list: qk_one = qk.strip() if qk_one == '': continue one_q1 = 阅读全文
posted @ 2026-07-14 21:52 刘宏缔的架构森林 阅读(4) 评论(0) 推荐(0)
摘要: 一,代码: base.html <!-- base.html --> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <!-- 预留标题块,并可以设置默认值 --> <title>{% block title %}我 阅读全文
posted @ 2026-07-12 23:16 刘宏缔的架构森林 阅读(4) 评论(0) 推荐(0)
摘要: 一,安装第三方库: $ pip install WTForms 二,代码 python: # app/api/users.py from fastapi import APIRouter, Depends from starlette.requests import Request from sta 阅读全文
posted @ 2026-07-12 23:16 刘宏缔的架构森林 阅读(4) 评论(0) 推荐(0)
摘要: OpenCode、OpenAI Codex 与 Claude Code 是目前主流的三大终端级(CLI/Agent)AI 编程工具。它们都支持直接在你的本地终端和代码库中运行,通过自然语言自动修改文件、运行测试、甚至自主定位 Bug。但在开源程度、核心逻辑、以及具体的适用场景上,三者存在明显的区别。 阅读全文
posted @ 2026-07-12 23:16 刘宏缔的架构森林 阅读(23) 评论(0) 推荐(0)
摘要: 一,代码 jwt功能模块和用户登录的两个依赖项: import hashlib from datetime import datetime, timedelta, timezone from typing import Optional from fastapi import FastAPI, De 阅读全文
posted @ 2026-06-29 20:09 刘宏缔的架构森林 阅读(2) 评论(0) 推荐(0)
摘要: 一,代码: plugin: from starlette.requests import Request from starlette_context.plugins import Plugin class PythonRequestPlugin(Plugin): # 1. 定义在 context 阅读全文
posted @ 2026-06-29 20:09 刘宏缔的架构森林 阅读(7) 评论(0) 推荐(0)
摘要: 一,安装第三方库 库地址: https://pypi.org/project/starlette-context/ 安装: $ pip install starlette-context 二,代码 1,登录后把用户信息保存到上下文中 from starlette_context.plugins im 阅读全文
posted @ 2026-06-29 20:09 刘宏缔的架构森林 阅读(8) 评论(0) 推荐(0)
摘要: 一,代码 说明:只针对admin管理后台,不影响其他子应用如api basic的代码 # app/core/adminbasic.py import secrets from fastapi import FastAPI, Depends, HTTPException, status from fa 阅读全文
posted @ 2026-06-29 20:09 刘宏缔的架构森林 阅读(6) 评论(0) 推荐(0)
摘要: 在生产环境中,不建议直接运行 uvicorn main:app,因为一旦程序崩溃不会自动重启,且无法利用多核 CPU。所以我们使用 Gunicorn 来管理 Uvicorn。 在 FastAPI 项目的线上部署中,Gunicorn 和 Supervisor 扮演着完全不同的角色,它们的分工极其明确。 阅读全文
posted @ 2026-06-25 23:12 刘宏缔的架构森林 阅读(20) 评论(0) 推荐(0)
摘要: 一,安装用到的第三方库,并初始化 $ pip install alembic 初始化,注意指定异步模板: alembic init -t async alembic 因为我们使用的是异步驱动(aiomysql),初始化时必须指定 async 异步模板:执行后,项目根目录下会多出 alembic.in 阅读全文
posted @ 2026-06-25 16:28 刘宏缔的架构森林 阅读(9) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 200 下一页