码迷,mamicode.com
首页 > 其他好文 > 详细

Flask - 消息闪现

时间:2018-01-08 23:48:11      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:nbsp   end   bsp   index   log   app   sage   username   out   

 1 @app.route(‘/‘)
 2 def index():
 3     flash(‘33333‘)
 4     flash(‘44444‘)
 5     flash(‘55555‘)
 6     flash(‘66666‘)
 7     if ‘username‘ in session:
 8         return render_template(‘test.html‘)
 9 
10     return render_template(‘test.html‘)

 

// test.html
1
<body> 2 {% with messages = get_flashed_messages() %} 3 {% for message in messages %} 4 {{ message }} 5 {% endfor %} 6 {% endwith %} 7 </body>

 

Flask - 消息闪现

标签:nbsp   end   bsp   index   log   app   sage   username   out   

原文地址:https://www.cnblogs.com/yugengde/p/8245430.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!