{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
<span>{{ message }}</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
flash(u'Invalid password provided', 'error')
The flashing system in python (flash in flask)basically makes it possible to record a message at the end of a request and access it next request and only next request. This is usually combined with a layout template that does this.