move SQLALCHEMY_ECHO option to create_app(): useful when profiling

This commit is contained in:
Son NK 2020-05-15 16:48:42 +02:00
parent aba0a534c0
commit f04caa3c35
1 changed files with 4 additions and 3 deletions

View File

@ -78,6 +78,9 @@ def create_app() -> Flask:
app.config["SQLALCHEMY_DATABASE_URI"] = DB_URI
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
# enable to print all queries generated by sqlalchemy
# app.config["SQLALCHEMY_ECHO"] = True
app.secret_key = FLASK_SECRET
app.config["TEMPLATES_AUTO_RELOAD"] = True
@ -168,7 +171,6 @@ def fake_data():
for i in range(31):
if i % 2 == 0:
a = Alias.create_new(user, f"e{i}@", mailbox_id=m1.id)
else:
a = Alias.create_new(user, f"e{i}@")
db.session.commit()
@ -546,8 +548,7 @@ if __name__ == "__main__":
#
# toolbar = DebugToolbarExtension(app)
# enable to print all queries generated by sqlalchemy
# app.config["SQLALCHEMY_ECHO"] = True
# warning: only used in local
if RESET_DB: