From b7839ec6b0822a759b6105daa144e77540a276f4 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Fri, 30 Apr 2021 12:06:51 +0200 Subject: [PATCH] Show db connexion error --- app/commands/lesia_db.py | 3 ++- resources/db_config.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/commands/lesia_db.py b/app/commands/lesia_db.py index 47063ac..8c03813 100644 --- a/app/commands/lesia_db.py +++ b/app/commands/lesia_db.py @@ -13,7 +13,8 @@ engine = create_engine(current_app.config['LESIA_AGENTS_DB_URI']) # reflect the tables try: lesia_base.prepare(engine, reflect=True) -except OperationalError: +except OperationalError as oe: + current_app.logger.error(oe) current_app.logger.error("Please, configure the mysql database (see db_config.py)") sys.exit(-1) diff --git a/resources/db_config.py b/resources/db_config.py index a4db016..bb76418 100644 --- a/resources/db_config.py +++ b/resources/db_config.py @@ -49,7 +49,7 @@ MYSQL_LESIA = { 'host': '127.0.0.1', 'port': '3306', } -mysql_lesia_uri = 'mysql+pymysql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % MYSQL +mysql_lesia_uri = 'mysql+pymysql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % MYSQL_LESIA # To set you databases uri, # uncomment the needed lines to fit your specific needs; -- libgit2 0.21.2