|
@@ -7,6 +7,7 @@ from flask_login import current_user
|
|
|
|
|
|
from configs import dify_config
|
|
|
from controllers.console.workspace.error import AccountNotInitializedError
|
|
|
+from extensions.ext_database import db
|
|
|
from models.model import DifySetup
|
|
|
from services.feature_service import FeatureService
|
|
|
from services.operation_service import OperationService
|
|
@@ -134,9 +135,13 @@ def setup_required(view):
|
|
|
@wraps(view)
|
|
|
def decorated(*args, **kwargs):
|
|
|
# check setup
|
|
|
- if dify_config.EDITION == "SELF_HOSTED" and os.environ.get("INIT_PASSWORD") and not DifySetup.query.first():
|
|
|
+ if (
|
|
|
+ dify_config.EDITION == "SELF_HOSTED"
|
|
|
+ and os.environ.get("INIT_PASSWORD")
|
|
|
+ and not db.session.query(DifySetup).first()
|
|
|
+ ):
|
|
|
raise NotInitValidateError()
|
|
|
- elif dify_config.EDITION == "SELF_HOSTED" and not DifySetup.query.first():
|
|
|
+ elif dify_config.EDITION == "SELF_HOSTED" and not db.session.query(DifySetup).first():
|
|
|
raise NotSetupError()
|
|
|
|
|
|
return view(*args, **kwargs)
|