python+jinja2编写前端界面,发生Unexpected end of template问题,求解决!
ringa_lee
ringa_lee 2017-05-27 17:39:39
[Python讨论组]




{{title}}


   

{{title}}

            
            
                
                
                
                Suite
                Status
            
            

            
                   

                       {% for n in list %}
                       {{ n['suite'] }}
                       Status
                   
                 
                 
                 
                      {% for i in n['suitecase'] %}
                      {% for a in i %}
                     {{ a['tag'] }}--{{ a['action'] }}--{{ a['element'] }}
             
                     
                   
                          

                                   {% if "success" in a['status'] %}

                                      Pass
                        
                                   {% elif "info" in a['status'] %}
                            
                                      Skip
                                
                                   {% elif "danger" in a['status']%}
                   
                                      Fail
                           
                                   {% else %}
                                      
                                      Error
                                  
                                   {% endif %} 

                              
                                   {% if "success" not in a['status'] %}
   
                                 
                    
                                   {% endif %}
  
                     
                                   {% if "success" not in a['status'] %}
                         
                                             

                                                  

                                                           

                            
                            {% endif %}
                            {% endfor %}
                                   {% endfor %}

                                     {% endfor %}
                  

                        

                           Total Test Runned:{{total_test}}
              
                        

                        

                                
                        
                    
                
        





将这个前端模板渲染,提示这个错误
jinja2.exceptions.TemplateSyntaxError: Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.

ringa_lee
ringa_lee

ringa_lee

全部回复(1)
伊谢尔伦

for 总共四个,endfor总共三个,所以楼主应该写少一个endfor吧,所以导致语法错误!

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号