Commit b7839ec6b0822a759b6105daa144e77540a276f4

Authored by hitier
1 parent a84fcae0

Show db connexion error

Showing 2 changed files with 3 additions and 2 deletions   Show diff stats
app/commands/lesia_db.py
@@ -13,7 +13,8 @@ engine = create_engine(current_app.config['LESIA_AGENTS_DB_URI']) @@ -13,7 +13,8 @@ engine = create_engine(current_app.config['LESIA_AGENTS_DB_URI'])
13 # reflect the tables 13 # reflect the tables
14 try: 14 try:
15 lesia_base.prepare(engine, reflect=True) 15 lesia_base.prepare(engine, reflect=True)
16 -except OperationalError: 16 +except OperationalError as oe:
  17 + current_app.logger.error(oe)
17 current_app.logger.error("Please, configure the mysql database (see db_config.py)") 18 current_app.logger.error("Please, configure the mysql database (see db_config.py)")
18 sys.exit(-1) 19 sys.exit(-1)
19 20
resources/db_config.py
@@ -49,7 +49,7 @@ MYSQL_LESIA = { @@ -49,7 +49,7 @@ MYSQL_LESIA = {
49 'host': '127.0.0.1', 49 'host': '127.0.0.1',
50 'port': '3306', 50 'port': '3306',
51 } 51 }
52 -mysql_lesia_uri = 'mysql+pymysql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % MYSQL 52 +mysql_lesia_uri = 'mysql+pymysql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % MYSQL_LESIA
53 53
54 # To set you databases uri, 54 # To set you databases uri,
55 # uncomment the needed lines to fit your specific needs; 55 # uncomment the needed lines to fit your specific needs;