会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
jason2018
苦难是最好的大学
博客园
首页
新随笔
联系
订阅
管理
2023年6月1日
Flask017_引入模板
摘要: 文档结构 header.html 1 <style> 2 .nav ul { 3 overflow: hidden; 4 } 5 6 .nav ul li { 7 float: left; 8 margin: 0 20px; 9 } 10 </style> 11 <nav class="nav">
阅读全文
posted @ 2023-06-01 15:23 jason2018
阅读(20)
评论(0)
推荐(0)
2023年5月31日
Flask016_模板继承
摘要: 父模板 base.html 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <meta
阅读全文
posted @ 2023-05-31 10:31 jason2018
阅读(8)
评论(0)
推荐(0)
Flask015_宏和 import 语句
摘要: 宏 forms.html 1 {% macro input(name, value="",type="text") %} 2 <input type="{{ type }}" value="{{ value | escape }}" name="{{ name }}"> 3 {% endmacro
阅读全文
posted @ 2023-05-31 08:55 jason2018
阅读(16)
评论(0)
推荐(0)
2023年5月29日
Flask014_ for 循环语句
摘要: 调用 1 @app.route('/for') 2 def for_statement(): 3 books = [{ 4 'title': '三国演义', 5 'author': '罗贯中', 6 'price': 100 7 }, 8 { 9 'title': '水浒传', 10 'author
阅读全文
posted @ 2023-05-29 14:49 jason2018
阅读(20)
评论(0)
推荐(0)
Flask013_ if 判断语句
摘要: 调用 1 @app.route('/if') 2 def if_statement(): 3 age = 18 4 return render_template('if.html', age=age) if.html 1 <!DOCTYPE html> 2 <html lang="en"> 3 <h
阅读全文
posted @ 2023-05-29 10:32 jason2018
阅读(41)
评论(0)
推荐(0)
Flask012_测试器
摘要: 待用到时再学习
阅读全文
posted @ 2023-05-29 09:59 jason2018
阅读(6)
评论(0)
推荐(0)
Flask011_内置过滤器
摘要: 待用到时再学习
阅读全文
posted @ 2023-05-29 09:58 jason2018
阅读(5)
评论(0)
推荐(0)
Flask010_自定义过滤器
摘要: 在模板中,通过过滤器实现对变量的处理。 过滤器本质上是 Python 的函数,它会把被过滤器的值当作第1个参数传送给函数。 自定义过滤器 定义 1 def datetime_format(value, format="%Y-%m-%d %H:%M"): 2 return value.strftime
阅读全文
posted @ 2023-05-29 09:56 jason2018
阅读(16)
评论(0)
推荐(0)
2023年5月26日
Flask009_模板的使用
摘要: 渲染模板 index.html 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>首页</title> 6 </head> 7 <body> 8 <h1>这是首页</h1> 9 </body
阅读全文
posted @ 2023-05-26 14:25 jason2018
阅读(12)
评论(0)
推荐(0)
Flask008_构造 URL
摘要: 通过 url_for 函数构造 URL。 url_for 接收视图函数名作为第1个参数,以及其他 URL 定义时的参数,其他参数添加到 URL 的后面作为查询字符串参数。 1 @app.route('/blog/<int:blog_id>') 2 def blog_detail(blog_id):
阅读全文
posted @ 2023-05-26 10:48 jason2018
阅读(26)
评论(0)
推荐(0)
下一页
公告