diff --git a/init_db.py b/init_db.py index d4d7219..0a53bef 100644 --- a/init_db.py +++ b/init_db.py @@ -2,7 +2,7 @@ from werkzeug.security import generate_password_hash from flask_sqlalchemy import SQLAlchemy from sqlalchemy_json import mutable_json_type -from modules.helpers import generateToken +from modules.helpers import logger, generateToken app = Flask(__name__) @@ -88,7 +88,8 @@ def __repr__(self): } ) db.session.add(settings) - db.session.commit() - - users = User.query.all() - print("Database is created...") + try: + db.session.commit() + logger.info("Database is created...") + except Exception: + logger.info('Database already created')