Skip to content
Myr

Fixed a broken example in the docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent f5d2d32 · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:docs/quickstart.rst+4 added-1 removed
626 unmodified lines
627628In order to use sessions you have to set a secret key. Here is how629sessions work::630631 from flask import session, redirect, url_for, escape631 from flask import Flask, session, redirect, url_for, escape, request632633 app = Flask(__name__)634635 @app.route('/')636 def index():637 if 'username' in session:638 return 'Logged in as %s' % escape(session['username'])
14 unmodified lines
653 @app.route('/logout')654 def logout():655 # remove the username from the session if its there656 session.pop('username', None)657 return redirect(url_for('index'))658659 # set the secret key. keep this really secret:660 app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'661
57 unmodified lines