|
|
@ -16,7 +16,11 @@ Simple Flashing |
|
|
|
|
|
|
|
|
|
|
|
So here is a full example:: |
|
|
|
So here is a full example:: |
|
|
|
|
|
|
|
|
|
|
|
from flask import flash, redirect, url_for, render_template |
|
|
|
from flask import Flask, flash, redirect, render_template, \ |
|
|
|
|
|
|
|
request, url_for |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
|
|
|
|
|
app.secret_key = 'some_secret' |
|
|
|
|
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
@app.route('/') |
|
|
|
def index(): |
|
|
|
def index(): |
|
|
@ -34,6 +38,10 @@ So here is a full example:: |
|
|
|
return redirect(url_for('index')) |
|
|
|
return redirect(url_for('index')) |
|
|
|
return render_template('login.html', error=error) |
|
|
|
return render_template('login.html', error=error) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
|
|
app.run() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
And here the ``layout.html`` template which does the magic: |
|
|
|
And here the ``layout.html`` template which does the magic: |
|
|
|
|
|
|
|
|
|
|
|
.. sourcecode:: html+jinja |
|
|
|
.. sourcecode:: html+jinja |
|
|
|