In Flask, if you can use the session, then we do not directly use cookies, because the sessions are some security
= Request username. Cookies .get ( 'username')
=================
RESP = make_response (the render_template (...))
RESP. the set_cookie ( 'username', 'The username ')
===============
use the redirect () function can be redirected. Use abort () can quit earlier request, and returns an error code
to use errorhandler () decorator can be customized error page:
=========
from flask import Flask, session
@app.route('/login', methods=['GET', 'POST'])
def login():
session['username'] = request.form['username']
return redirect(url_for('index'))
app.route @ ( '/ Zimbabwe Logout')
DEF Zimbabwe Logout ():
# If the session user name to remove it.
the session .pop ( 'username', None)
return the redirect (the url_for ( 'index'))
=============
Flash ()for a flash message. In the template, using get_flashed_messages () operates message