状況
現在、FlaskでWebアプリケーションを作成しています。
index.html
を読み込もう(ブラウザ上で表示しよう)とした時にエラーが発生します。
実行しているコード(一部)
python
1"""app.py""" 2@app.route("/") 3def index(): 4 return render_template("index.html", system_info=get_system_info())
HTML
1<!-- index.html --> 2{% block page_content %} 3<div class="container" id="main"> 4 <div class="row"> 5 <div class="col-md-9"> 6 {% include 'index_partial/datasets.html' %} 7 </div> 8 <div class="col-md-3"> 9 {% include 'common/resource_info.html' %} 10 </div> 11 </div> 12 </div> 13{% endblock %}
HTML
1<!-- index_partial/datasets.html --> 2<div class="subtitle"> 3 <h2>Dataset</h2> 4 <div class="button_div" right> 5 <a href="#"> 6 <button class="btn btn-cyber" data-toggle="model" data-target="#upload_model"> 7 <span class="glyphicon glyphicon-plus"></span>New 8 </button> 9 </a> 10 </div> 11</div> 12<div class="datasets"> 13 <div class="datasets_row"> 14 {% for dataset in datasets %} 15 <div class="dataset image" id="dataset_{{ dataset.id }}" data-id="{{ dataset.id}}"> 16 <h3>{{ dataset.name }}</h3> 17 <span class="desc">Total {{ dataset.file_num }} Images</span> 18 {% for img in dataset.thumbnails %} 19 <img src="{{img}}" class="img-responsive img-rounded thumbnail-30"> 20 {% endfor %} 21 </div> 22 {% endfor %} 23 </div> 24 {% if dataset_count > 3 %} 25 <button class="btn btn-cyber btn-block" id="dataset_more" data-offset="3">more</button> 26 {% endif %} 27</div>
エラーメッセージの内容
jinja2.exceptions.TemplateSyntaxError jinja2.exceptions.TemplateSyntaxError: unexpected '%'
上記のように、「%
が変なところに付いている」というエラーだと思います。
しかし、エラーの元を探しても間違っていそうな場所を見つけられず、質問しました。
試したこと
index.html
の {% include 'index_partial/datasets.html' %}
を消してみると、エラーが消えたので
問題はここにあると思います。
別の質問を立ち上げました
よろしくお願いします
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/29 02:38
2018/12/29 02:39
2018/12/29 07:49 編集
2018/12/29 08:15
2018/12/29 08:16