Files
pear-admin-flask/plugins/navManager/__init__.py
T
bwstudio 0ffc103e46 feat(plugins): 4 个业务插件代码 + 前台公开页面改造
plugins/navManager:导航 CRUD + 导航分类 CRUD(独立 blueprint)
plugins/friendManager:友情链接 CRUD
plugins/aboutManager:关于本站 CRUD
plugins/siteStats:访问统计主页 + JSON 接口 + /site/* GET 埋点 + nav 卡片点击埋点

applications/view/public/nav.py:导航聚合页 / 分类详情 / JSON 接口,支持 visit_count 注入
applications/view/public/about.py:关于本站公开页
applications/view/public/friend.py:友情链接公开页

templates/public/base.html:响应式首页(搜索框 / 分类抽屉 / 5 主题切换 / footer 隐私小字)
templates/public/index.html / category.html:卡片右下角访问次数
templates/public/about.html / friend.html:关于 + 友链前台页

docs/plugins-development.md:插件开发完整指南(生命周期 + 4 个示例 + FAQ + framework 迁移)

scripts/:探针与端到端验证脚本(probe_*/verify_*/test_*)
2026-09-06 18:18:06 +08:00

20 lines
761 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
导航管理插件入口
通过 Pear Admin Flask 插件系统注册到 /system/nav/* 与 /system/nav-category/* 路径。
此插件不修改 framework 任何代码,仅挂在对应前缀下,注册蓝图即可。
数据层沿用 applications.models.{Nav, NavCategory}SQLAlchemy 模型必须由 framework 加载以便 Alembic 跟踪)。
"""
from flask import Flask
from .view.nav import bp
from .view.nav_category import bp as nav_category_bp
def event_init(app: Flask):
"""初始化完成时注册蓝图到 app(直接挂到 app,而不是 framework 的 system_bp)。"""
app.register_blueprint(bp)
app.register_blueprint(nav_category_bp)
print(" * navManager: registered /system/nav/* and /system/nav-category/* blueprints")