Skip to content

Commit

Permalink
Update init_db.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DewGew authored Nov 2, 2023
1 parent f714bea commit c87bd75
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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')

0 comments on commit c87bd75

Please sign in to comment.