Handle race in database creation when running multiple WSGI instances

This commit is contained in:
JanB 2016-04-17 17:30:55 +02:00
parent 24b2b0a1ce
commit df480160da
1 changed files with 7 additions and 3 deletions

View File

@ -161,6 +161,10 @@ Session.configure(bind=engine)
session = Session()
if not os.path.exists(dbpath):
Base.metadata.create_all(engine)
create_default_config()
create_admin_user()
try:
Base.metadata.create_all(engine)
create_default_config()
create_admin_user()
except Exception:
pass