🗒️flask 入门
type
status
slug
summary
tags
category
icon
password
Date
最小实现示例
hello.py
templates/hello.html
bash
实际中可能的例子
- 第一行设置应用的
ENVIRONMENT配置项。
- 第二行使用
update方法更新应用的配置。如果config参数为None,则使用空字典。
db.init_app(app): 使用应用实例初始化数据库。
admin.init_app(app): 使用应用实例初始化后台管理。
app.register_blueprint(index_bp): 注册index_bp蓝图,以添加与首页相关的路由。
register_processors(app): 调用register_processors函数,可能是为了注册一些自定义的模板处理器。
比如,注册一个将日期字符串格式化为更易读格式的处理器
在模板中使用:
Loading...