flask session test
This commit is contained in:
parent
a8023a0780
commit
0523b16f80
21
23_flask_session_test.py
Normal file
21
23_flask_session_test.py
Normal 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)
|
@ -21,4 +21,5 @@
|
|||||||
1. **19_tsv-to-csv.py**: Convert TSV to CSV
|
1. **19_tsv-to-csv.py**: Convert TSV to CSV
|
||||||
1. **20_restore_file_from_git.py**: Restore file from Git History
|
1. **20_restore_file_from_git.py**: Restore file from Git History
|
||||||
1. **21_twitter_bot.py**: Twitter Bot
|
1. **21_twitter_bot.py**: Twitter Bot
|
||||||
1. **22_git_tag.py**: Create Git Tag based on a commit
|
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.
|
Loading…
Reference in New Issue
Block a user