@app.route('/login', methods = ['GET', 'POST'])
def login():
if request.method == 'POST':
session['username'] = request.form['username']
return redirect(url_for('index'))
return '''
This is the "template" for a flask session login. My question is,
'username'
is mapped to only one value which is the request.form['username']
So what if I have two users login,
(1) 'jack'
So now session['username'] = jack
And then
(2) 'davis'
So now session['username'] = davis
But then jack is not logged in anymore. How do I do this?
Sessions in Flask are cookie-based, meaning that is not necessarily IP/user/request based unless you develop the server logic in this way. The fact that sessions are cookies based allows the user to read the content, so be aware of what you put there.
As of Flask 1.0, flask server is multi-threaded by default. Each new request is handled in a new thread. This is a simple Flask application using default settings.
The data that is required to be saved in the Session is stored in a temporary directory on the server. The data in the Session is stored on the top of cookies and signed by the server cryptographically. Each client will have their own session where their own data will be stored in their session.
The series was renewed for a ninth and final season in March 2022. As of June 29, 2022, 171 episodes of The Flash have aired, concluding the eighth season.
It works. Just test the users (sessions) with at least one user opened in an incognito browser window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With