9 lines
208 B
Python
9 lines
208 B
Python
|
from flask import g
|
||
|
from time import time
|
||
|
from app import app
|
||
|
|
||
|
@app.before_request
|
||
|
def request_time():
|
||
|
g.request_start_time = time()
|
||
|
g.request_time = lambda: "%.5fs" % (time() - g.request_start_time)
|