8000 flask session test · liuhuimin/python-scripts@0523b16 · GitHub
[go: up one dir, main page]

Skip to content
Sign in

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0523b16

Browse files
committed
flask session test
1 parent a8023a0 commit 0523b16

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

23_flask_session_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
from flask import < 8000 span class=pl-v>Flask, session, url_for, redirect
3+
4+
app = Flask(__name__)
5+
app.secret_key = 'secret'
6+
7+
8+
@app.route('/')
9+
def set():
10+
session.clear()
11+
session['works'] = True
12+
return redirect(url_for('get'))
13+
14+
15+
@app.route('/get')
16+
def get():
17+
works = session.get('works', False)
18+
return str(works)
19+
20+
< 8670 /td>21+
app.run(sys.argv[1], use_reloader=False)

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
1. **19_tsv-to-csv.py**: Convert TSV to CSV
2222
1. **20_restore_file_from_git.py**: Restore file from Git History
2323
1. **21_twitter_bot.py**: Twitter Bot
24-
1. **22_git_tag.py**: Create Git Tag based on a commit
24+
1. **22_git_tag.py**: Create Git Tag based on a commit
25+
1. **23_flask_session_test.py**: Just a simple app to see if the sessions are working.

0 commit comments

Comments
 (0)
0