Skip to content

Commit f71d754

Browse files
committed
fix(project remove): resolve MONGODB_URI via ensure_mongodb before dropping databases
1 parent 975e748 commit f71d754

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/dbx_python_cli/commands/project.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,10 +1160,17 @@ def _drop_project_databases(proj, python_path: str) -> None:
11601160
"""Drop all MongoDB databases declared in the project's Django settings."""
11611161
import json as _json
11621162

1163+
from dbx_python_cli.commands.mongodb import ensure_mongodb
1164+
11631165
env = os.environ.copy()
11641166
env["DJANGO_SETTINGS_MODULE"] = f"{proj.name}.settings.{proj.name}"
11651167
env["PYTHONPATH"] = str(proj.project_path)
11661168

1169+
try:
1170+
env = ensure_mongodb(env)
1171+
except Exception:
1172+
pass
1173+
11671174
script = "\n".join(
11681175
[
11691176
"import json, django, pymongo",

0 commit comments

Comments
 (0)