Forráskód Böngészése

move SQLALCHEMY_ECHO option to create_app(): useful when profiling

Son NK 5 éve
szülő
commit
f04caa3c35
1 módosított fájl, 4 hozzáadás és 3 törlés
  1. 4 3
      server.py

+ 4 - 3
server.py

@@ -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: