{% with messages = get_flashed_messages() %} {% if messages %} {% for message in messages %} <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> {{ message }} </div> {% endfor %} {% endif %} {% endwith %}