flask session test

This commit is contained in:
Michael Herman 2015-01-07 12:01:29 -07:00
parent a8023a0780
commit 0523b16f80
2 changed files with 23 additions and 1 deletions

21
23_flask_session_test.py Normal file
View File

@ -0,0 +1,21 @@
import sys
from flask import Flask, session, url_for, redirect
app = Flask(__name__)
app.secret_key = 'secret'
@app.route('/')
def set():
session.clear()
session['works'] = True
return redirect(url_for('get'))
@app.route('/get')
def get():
works = session.get('works', False)
return str(works)
app.run(sys.argv[1], use_reloader=False)

View File

@ -22,3 +22,4 @@
1. **20_restore_file_from_git.py**: Restore file from Git History
1. **21_twitter_bot.py**: Twitter Bot
1. **22_git_tag.py**: Create Git Tag based on a commit
1. **23_flask_session_test.py**: Just a simple app to see if the sessions are working.