Criando o Layout Base
Nosso primeiro passo é criar um layout base que será usado para todas as nossas páginas. Este layout base incluirá os elementos comuns da nossa aplicação, como a barra de navegação e o título da página.
<!-- flaskr/templates/base.html -->
<!doctype html>
<title>{% block title %}{% endblock %} - Flaskr</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
<nav>
<h1>Flaskr</h1>
<ul>
{% if g.user %}
<li><span>{{ g.user['username'] }}</span></li>
<li><a href="{{ url_for('auth.logout') }}">Log Out</a> {% else %}</li>
<li><a href="{{ url_for('auth.register') }}">Register</a></li>
<li>
<a href="{{ url_for('auth.login') }}">Log In</a>
{% endif %}
</li>
</ul>
</nav>
<section class="content">
<header>{% block header %}{% endblock %}</header>
{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %} {% block content %}{% endblock %}
</section>