fix startup crash in flask app

This commit is contained in:
Max 2022-10-09 09:37:28 -04:00
parent 7dc6d61f75
commit ebc980c205
1 changed files with 6 additions and 5 deletions

View File

@ -51,12 +51,13 @@ app.config['SQLALCHEMY_ECHO'] = False # set to True to send sql statements to t
app.secret_key = b'kH8HT0ucrh' # random bytes - this key not used anywhere else
db = SQLAlchemy(app)
db.init_app(app)
try:
db.reflect(app=app)
db.init_app(app)
except OperationalError as e:
raise(e) # database is locked by another process
with app.app_context():
try:
db.reflect()
except OperationalError as e:
raise(e) # database is locked by another process
class MyDateType(types.TypeDecorator):
impl = types.REAL