Created
October 11, 2017 04:03
-
-
Save allenyang79/919a48b79c996cb8d3efb1f14be6c8db to your computer and use it in GitHub Desktop.
test flask session config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from flask import Flask, session | |
app = Flask(__name__) | |
app.config['SECRET_KEY']= 'session123' | |
app.config['SESSION_COOKIE_PATH'] = '/count/deep' | |
@app.route('/') | |
def index(): | |
return 'index' | |
@app.route('/count') | |
def count(): | |
count = session.get('count', 0) | |
session['count'] = count + 1 | |
return str(session['count']) | |
@app.route('/count/deep') | |
def count_deep(): | |
count = session.get('count', 0) | |
session['count'] = count + 1 | |
return str(session['count']) | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment