[WEB-4720] fix: mongo connection class to initialize mongo db #7652
This commit is contained in:
parent
0e6fbaee3a
commit
ddeabeeeb1
2 changed files with 7 additions and 0 deletions
|
|
@ -465,3 +465,7 @@ if ENABLE_DRF_SPECTACULAR:
|
||||||
REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "drf_spectacular.openapi.AutoSchema"
|
REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "drf_spectacular.openapi.AutoSchema"
|
||||||
INSTALLED_APPS.append("drf_spectacular")
|
INSTALLED_APPS.append("drf_spectacular")
|
||||||
from .openapi import SPECTACULAR_SETTINGS # noqa: F401
|
from .openapi import SPECTACULAR_SETTINGS # noqa: F401
|
||||||
|
|
||||||
|
# MongoDB Settings
|
||||||
|
MONGO_DB_URL = os.environ.get("MONGO_DB_URL", False)
|
||||||
|
MONGO_DB_DATABASE = os.environ.get("MONGO_DB_DATABASE", False)
|
||||||
|
|
|
||||||
|
|
@ -118,4 +118,7 @@ class MongoConnection:
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if MongoDB is configured and connected, False otherwise
|
bool: True if MongoDB is configured and connected, False otherwise
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if cls._client is None:
|
||||||
|
cls._instance = cls()
|
||||||
return cls._client is not None and cls._db is not None
|
return cls._client is not None and cls._db is not None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue