Skip to content

Commit 66b450a

Browse files
committed
docs: update project management and venv strategy docs
- Fix incorrect --random flag (omitting name generates random project name) - Document --wagtail, --qe, and stackable flag examples - Add "Installing Local Clones" section for the new --with flag - Document auto-venv creation behaviour in both project-management and venv-strategy - Update Virtual Environments section to remove outdated limitation note
1 parent 5a1c9d7 commit 66b450a

2 files changed

Lines changed: 42 additions & 6 deletions

File tree

docs/design/venv-strategy.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ Commands detect and use venvs in this priority order (most specific first):
105105
3. **Base directory venv** - ``<base_path>/.venv``
106106
4. **Activated venv** - The current ``sys.executable`` or shell-activated Python if it is inside a venv
107107
5. **Auto-detected venv** - If exactly one venv exists in the base directory, it is used automatically
108-
6. **Error** - Installation to system Python is not allowed
108+
6. **Auto-created venv** (``dbx project add`` only) - If no venv is found, one is created automatically at the ``projects/`` group level and Django is bootstrapped into it
109+
7. **Error** - Installation to system Python is not allowed (all other commands)
109110

110111
You'll see clear messages indicating which venv is being used:
111112

docs/features/project-management.rst

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,28 @@ Create a new Django project with the ``add`` command:
5050
# Create without frontend
5151
dbx project add myproject --no-frontend
5252
53-
# Generate a random project name
54-
dbx project add --random
53+
# Generate a random project name (omit the name argument)
54+
dbx project add
5555
5656
# Create in a custom directory
5757
dbx project add myproject -d ~/custom/path
5858
59-
The ``--random`` flag generates a creative project name using random adjectives and nouns (e.g., "cosmic_nebula", "quantum_forest").
59+
# Enable Wagtail CMS
60+
dbx project add myproject --wagtail
61+
62+
# Enable Queryable Encryption
63+
dbx project add myproject --qe
64+
65+
# Stack flags: Wagtail + QE
66+
dbx project add myproject --wagtail --qe
67+
68+
# Install local clones into the project venv after creation
69+
dbx project add myproject --with medical-records
70+
dbx project add myproject --with django --with django-mongodb-extensions
71+
72+
Omitting the project name generates a random name from adjectives and nouns (e.g., ``swift_seal``, ``brave_eagle``).
73+
74+
If no virtual environment exists when ``dbx project add`` runs, one is created automatically at the ``projects/`` group level and Django is installed into it before scaffolding begins.
6075

6176
Project Structure
6277
-----------------
@@ -310,6 +325,26 @@ This will:
310325

311326
When using the ``--directory`` flag, you must specify the project name explicitly.
312327

328+
Installing Local Clones
329+
-----------------------
330+
331+
The ``--with`` flag installs one or more local clones (managed by ``dbx clone``) as editable packages into the project venv immediately after project creation:
332+
333+
.. code-block:: bash
334+
335+
# Install a single local clone
336+
dbx project add myproject --with medical-records
337+
338+
# Install multiple local clones
339+
dbx project add myproject --with django --with django-mongodb-extensions
340+
341+
# Combine with other flags
342+
dbx project add myproject --wagtail --with medical-records
343+
344+
Each ``--with`` value is looked up by name using the same discovery logic as ``dbx install`` (respecting group priority from your config). If a clone is not found locally a warning is printed and that repo is skipped — the project is still created successfully.
345+
346+
This is useful when you want to develop against a local fork or in-progress version of a library rather than the PyPI release. For a dependency already in ``pyproject.toml`` (e.g. ``django-mongodb-extensions``), specifying ``--with`` reinstalls it from the local clone, overriding the PyPI version.
347+
313348
Virtual Environments
314349
--------------------
315350

@@ -323,11 +358,11 @@ Projects use a shared virtual environment in the ``projects/`` directory:
323358
# List all virtual environments
324359
dbx env list
325360
326-
**Current Limitation**: The virtual environment is created at the ``projects/`` level, not per individual project. This means all projects in the ``projects/`` directory share the same virtual environment.
361+
**Auto-creation**: If no virtual environment is found when ``dbx project add`` runs, one is created automatically at the ``projects/`` group level (``base_dir/projects/.venv``) and Django is bootstrapped into it before project scaffolding begins. You do not need to run ``dbx env init`` manually before your first ``dbx project add``.
327362

328363
.. note::
329364

330-
**Future Enhancement**: Per-project virtual environments (e.g., ``projects/myproject/.venv``) may be added in a future release. For now, if you need isolated environments for different projects, you can use the ``--directory`` flag to create projects in separate locations and manage their virtual environments independently.
365+
All projects in the ``projects/`` directory share the same virtual environment. If you need full isolation, use the ``--directory`` flag to create projects in separate locations and manage their virtual environments independently.
331366

332367
Configuration
333368
-------------

0 commit comments

Comments
 (0)