1

Server - Flask + Python 2.6.2 + CentOS

Dashboard

@app.route('/admin/dashboard')
def admin_dashboard():
    return render_template('admin/dashboard.html')

I tried to load dashboard.html with header.thml

dashboard.html

{% include 'header.html' %}
<div>
    dashboard
</div>

After this I get this error.

jinja2.exceptions.TemplateNotFound
TemplateNotFound: header.html

I tried other methods, and it didn't work..

Can you see what is the problem?

Jake
  • 1,195
  • 6
  • 21
  • 42

1 Answers1

2

From http://flask.pocoo.org/docs/quickstart/, your templates need to be in a folder named "templates". Header.html should be in [project]/templates/header.html.

Neil
  • 2,378
  • 1
  • 20
  • 28
  • Thanks!! I put my file template/admin/header.html like this. I changed it {% include 'admin/header.html' %} and it worked! Thank you. – Jake Dec 17 '13 at 02:59