feat: 前端页面使用网站基础配置
- 使用 Flask context_processor 自动注入 site_config - 所有页面标题使用 site_name 配置 - 所有页面导航栏品牌使用 site_name 配置 - 所有页面底部使用 site_footer 配置 - 文件上传时使用 max_file_size 配置验证文件大小 - 显示最大文件限制提示
This commit is contained in:
@@ -34,6 +34,14 @@ db.init_app(app)
|
||||
# 注册后台管理蓝图
|
||||
app.register_blueprint(admin_bp)
|
||||
|
||||
# Context processor - 所有模板自动获得 site_config
|
||||
@app.context_processor
|
||||
def inject_site_config():
|
||||
def get_config():
|
||||
from admin import get_site_config
|
||||
return get_site_config()
|
||||
return {'site_config': get_config()}
|
||||
|
||||
# 初始化服务
|
||||
cache_service = CacheService(CACHE_DIR, CACHE_EXPIRE_DAYS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user