fix startup crash in flask app
This commit is contained in:
parent
7dc6d61f75
commit
ebc980c205
|
@ -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
|
app.secret_key = b'kH8HT0ucrh' # random bytes - this key not used anywhere else
|
||||||
|
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
db.init_app(app)
|
||||||
|
|
||||||
try:
|
with app.app_context():
|
||||||
db.reflect(app=app)
|
try:
|
||||||
db.init_app(app)
|
db.reflect()
|
||||||
except OperationalError as e:
|
except OperationalError as e:
|
||||||
raise(e) # database is locked by another process
|
raise(e) # database is locked by another process
|
||||||
|
|
||||||
class MyDateType(types.TypeDecorator):
|
class MyDateType(types.TypeDecorator):
|
||||||
impl = types.REAL
|
impl = types.REAL
|
||||||
|
|
Loading…
Reference in New Issue