From fc3e7ba079ac60d29d0c2df93c9b03a866213178 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 27 Aug 2021 17:25:18 +0200 Subject: [PATCH] display db URI at startup. --- app/__init__.py | 4 +++- tools/debian/postinst | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index fa9bb0c0..9d64174b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -51,7 +51,9 @@ def create_app(config_class=DevConfig): app.logger.setLevel(logging.DEBUG) app.config.from_object(config_class) - app.logger.info(f"create_app({config_class.__name__})") + app.logger.info( + f"create_app({config_class.__name__}, {config_class.SQLALCHEMY_DATABASE_URI})" + ) db.init_app(app) migrate.init_app(app, db) login.init_app(app) diff --git a/tools/debian/postinst b/tools/debian/postinst index 835425d6..3ef84dae 100644 --- a/tools/debian/postinst +++ b/tools/debian/postinst @@ -99,7 +99,7 @@ then echo "Upgrading existing SCODOC database..." # utilise les scripts dans migrations/version/ # pour mettre à jour notre base (en tant qu'utilisateur scodoc) - export SQLALCHEMY_DATABASE_URI="postgresql:///SCODOC" + export FLASK_ENV="production" su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask db upgrade)" "$SCODOC_USER" fi