fix: make sure we don't initialize the DB connector twice

This commit is contained in:
ziirish 2023-07-07 15:07:35 +02:00
parent 779f6efdc4
commit b1c9e0dc09

View file

@ -110,7 +110,8 @@ def create_db(myapp, cli=False, unittest=False, create=True, celery_worker=False
myapp.config["SQLALCHEMY_POOL_SIZE"] = 20 myapp.config["SQLALCHEMY_POOL_SIZE"] = 20
myapp.config["SQLALCHEMY_POOL_RECYCLE"] = 600 myapp.config["SQLALCHEMY_POOL_RECYCLE"] = 600
db.init_app(myapp) if "sqlalchemy" not in myapp.extensions:
db.init_app(myapp)
if not cli and not unittest and not celery_worker: # pragma: no cover if not cli and not unittest and not celery_worker: # pragma: no cover
with myapp.app_context(): with myapp.app_context():
try: try: