CLI Internal Modules
codex_django_cli.main
Top-level entrypoint for the interactive codex-django CLI.
codex_django_cli.engine
Template rendering and file generation engine for the CLI.
Examples:
Render a blueprint template manually::
from codex_django_cli.engine import CLIEngine
engine = CLIEngine()
content = engine.render_template("repo/README.md.j2", {"project_name": "demo"})
Classes
CLIEngine
Core engine for CLI template rendering and scaffold generation.
Source code in src/codex_django_cli/engine.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
Functions
__init__(blueprints_dir=None)
Initialize the engine and Jinja environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blueprints_dir
|
str | None
|
Optional path to the blueprint root. Defaults to
the bundled |
None
|
Source code in src/codex_django_cli/engine.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
render_template(template_name, context)
Render a blueprint template with the provided context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template path relative to the blueprint root. |
required |
context
|
dict[str, Any]
|
Render context passed into Jinja. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Rendered template text. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the template cannot be found. |
Source code in src/codex_django_cli/engine.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
scaffold(blueprint_name, target_dir, context, overwrite=False)
Copy a blueprint tree to the target directory.
The method renders .j2 files through Jinja and copies all other
files verbatim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blueprint_name
|
str
|
Blueprint path relative to the blueprint root. |
required |
target_dir
|
str
|
Filesystem directory where files should be written. |
required |
context
|
dict[str, Any]
|
Render context passed into Jinja templates. |
required |
overwrite
|
bool
|
Whether existing files may be replaced. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the named blueprint directory does not exist. |
Source code in src/codex_django_cli/engine.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
codex_django_cli.prompts
Thin wrappers around questionary prompts.
codex_django_cli.utils
Shared helper functions for CLI command execution and bootstrap tasks.
Functions
generate_secret_key()
Generate a Django-compatible SECRET_KEY value.
Source code in src/codex_django_cli/utils.py
11 12 13 14 15 | |
generate_field_encryption_key()
Generate a Fernet-compatible key for encrypted model fields.
Source code in src/codex_django_cli/utils.py
18 19 20 | |
run_django_command(args)
Execute a Django management command in-process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
list[str]
|
Command arguments without the leading program name. |
required |
Source code in src/codex_django_cli/utils.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
codex_django_cli.commands.init
CLI handler for project initialization.
Functions
handle_init(name, base_dir, target_dir=None, code_only=False, dev_mode=False, overwrite=False, enable_i18n=False, languages=None, with_cabinet=True, with_booking=False, with_conversations=True, with_public_booking=False, with_sw=False, with_cloud_db=False)
Scaffold a new codex-django project using module-selection orchestration.
Source code in src/codex_django_cli/commands/init.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
codex_django_cli.commands.install
Installation orchestrator for menu-first project scaffolding.
codex_django_cli.commands.repo
Helpers for generating repository-level config files.
Classes
Functions
handle_generate_repo_config(*, name, project_root, include_pyproject=True, include_env_example=True, overwrite=False)
Generate repository-level config files for a project.
Source code in src/codex_django_cli/commands/repo.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
codex_django_cli.commands.deploy
handle_generate_deploy
Generates Docker infrastructure and CI/CD files for a project.
Supports two deployment modes
- standalone: one project = full stack (nginx, redis, postgres, worker, bot)
- stack: multiple projects sharing nginx, redis, arq worker
Classes
Functions
handle_generate_deploy(name, project_root, deploy_mode='standalone', domain_name='example.com', with_bot=False, with_worker=False, with_notifications=False, enable_i18n=False, cluster_name=None, python_version='3.13', generate_docker=True, generate_cicd=True)
Generate deploy infrastructure files and CI/CD workflows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Project name used in templates and generated paths. |
required |
project_root
|
str
|
Repository root where deploy assets should be written. |
required |
deploy_mode
|
str
|
Deployment topology, for example |
'standalone'
|
domain_name
|
str
|
Public domain used in generated configs. |
'example.com'
|
with_bot
|
bool
|
Whether Telegram bot assets should be included. |
False
|
with_worker
|
bool
|
Whether worker assets should be included. |
False
|
with_notifications
|
bool
|
Whether notification-related deploy config is needed. |
False
|
enable_i18n
|
bool
|
Whether i18n-aware routing/templates should influence templates. |
False
|
cluster_name
|
str | None
|
Optional cluster identifier for shared-stack mode. |
None
|
python_version
|
str
|
Python version string injected into templates. |
'3.13'
|
generate_docker
|
bool
|
Whether Docker assets should be generated. |
True
|
generate_cicd
|
bool
|
Whether CI/CD workflow files should be generated. |
True
|
Source code in src/codex_django_cli/commands/deploy.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
codex_django_cli.commands.quality
handle_configure_precommit
Generates a .pre-commit-config.yaml with standard quality checks.
Functions
handle_configure_precommit(project_root)
Write a standard pre-commit configuration into a project root.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str
|
Repository root where config files should be created. |
required |
Source code in src/codex_django_cli/commands/quality.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
codex_django_cli.dev.project_tree
Project structure tree generator.
Scans a project directory and writes a human-readable tree to a text file. Interactive mode lets the user pick a top-level folder or the full project.
Usage (in a project's tools/dev/generate_project_tree.py):
from pathlib import Path
from codex_django_cli.dev.project_tree import ProjectTreeGenerator
if __name__ == "__main__":
ProjectTreeGenerator(Path(__file__).parent.parent.parent).interactive()
Classes
ProjectTreeGenerator
Source code in src/codex_django_cli/dev/project_tree.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
Functions
generate(target_dir, output)
Write tree to output file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dir
|
str | None
|
Sub-directory name to scan, or None for the full project. |
required |
output
|
Path
|
Path to the output .txt file. |
required |
Source code in src/codex_django_cli/dev/project_tree.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
interactive(output=None)
Show interactive folder selection menu and generate tree.
Source code in src/codex_django_cli/dev/project_tree.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |