Tutorial by Examples

Set SECKET_KEY, then flashing message in view function: from flask import Flask, flash, render_template app = Flask(__name__) app.secret_key = 'some_secret' @app.route('/') def index(): flash('Hello, I'm a message.') return render_template('index.html') Then render the messages...
Set second argument when use flash() in view function: flash('Something was wrong!', 'error') In the template, set with_categories=true in get_flashed_messages(), then you get a list of tuples in the form of (message, category), so you can use category as a HTML class. {% with messages = get_fl...

Page 1 of 1