My understanding is that flask.g object or flask.request are the thread local storage. However when I execute the following code, it shows the id of flask.g (and flask.request) is always same value in each threads:
from flask import Flask, request, g
app = Flask(__name__)
@app.route('/')
def hello():
print("g id: %d" % id(g))
print("request id: %d" % id(request))
return "Hello world"
if __name__ == "__main__":
app.run()
result (access three times with several browsers):
g id: 140219657264584
request id: 140219657262640
g id: 140219657264584
request id: 140219657262640
g id: 140219657264584
request id: 140219657262640
My understanding iswrong?