flask 免费bootstrap主题下载(flask 51)

2019-08-15 17:56:39 浏览数 (1)

https://bootswatch.com/ 下载完替换掉bootstrap.min.css就行

flask 上下文处理器,里面所有变量在整个网站共享

def register_template_context(app): @app.context_processor def make_template_context(): admin=Admin.query.first() categories=Category.query.order_by(Category.name).all() links=Link.query.order_by(Link.name).all() if current_user.is_authenticated: unread_comments=Comment.query.filter_by(reviewed=False).count() else: unread_comments=None return dict(admin=admin,categories=categories,links=links,unread_comments=unread_comments)

0 人点赞