Management Commands
Complete reference for all Django management commands, organized by app.
All commands are run with uv run manage.py <command>.
Diffusion
Command |
Synopsis |
Key Flags |
|---|---|---|
|
Sync |
|
|
Export DiffusionModel and LoraModel records to JSON. |
|
|
Bulk-import prompts from JSON or plain-text file. |
|
|
Export Prompt records to JSON. |
|
|
Import |
|
|
Pre-download HuggingFace models to local cache. |
|
Core
Command |
Synopsis |
Key Flags |
|---|---|---|
|
Import regions, countries, languages, and LLM models from |
|
|
Export reference data to six separate JSON files. |
|
|
Import Jinja2 prompt templates from JSON. Auto-increments version on content changes. |
|
|
Export active PromptTemplate records to JSON. |
|
|
Export combined LLM models and languages to a single JSON file (legacy). |
|
Audiences
Command |
Synopsis |
Key Flags |
|---|---|---|
|
Import audience segments from JSON. Keyed on |
|
|
Export Segment records to |
|
|
Import personas and segment mappings from two JSON files. Resolves geographic FKs by code. |
|
|
Export Persona records to |
|
TV Spots
Command |
Synopsis |
Key Flags |
|---|---|---|
|
Import brand records from JSON. Keyed on |
|
|
Export Brand records to |
|
|
Import a TV spot from a JSON file. Creates Campaign + origin VideoAdUnit + script rows. |
|
|
Import adaptation markets from |
|
|
Export adaptation markets to |
|
Common Flags
--dry-run
Preview what would change without writing to the database. Supported by most import commands:
uv run manage.py import_reference_data --dry-run
uv run manage.py import_prompt_templates --dry-run
uv run manage.py import_segments --dry-run
uv run manage.py import_personas --dry-run
uv run manage.py import_brands --dry-run
uv run manage.py import_tvspot data/spot.json --dry-run
uv run manage.py import_adaptations --dry-run
--dir
Override the default data/ directory for file I/O. Supported by reference data, audiences, brands, and prompt template commands:
uv run manage.py export_reference_data --dir backups/2026-02/
uv run manage.py import_reference_data --dir backups/2026-02/
uv run manage.py export_segments --dir backups/2026-02/
--file
Override the exact file path (instead of directory). Used by preset, prompt, and market commands:
uv run manage.py import_presets --file custom/presets.json
uv run manage.py export_prompts --file output/prompts.json
Import Dependency Order
When populating a new environment, import data in this sequence:
# 1. Core reference data (handles internal dependencies)
uv run manage.py import_reference_data
# 2. Prompt templates
uv run manage.py import_prompt_templates
# 3. Diffusion presets (models and LoRAs)
uv run manage.py import_presets
# 4. Audience segments
uv run manage.py import_segments
# 5. Personas (depends on segments + reference data)
uv run manage.py import_personas
# 6. Brands
uv run manage.py import_brands
# 7. TV spots (depends on reference data for language lookup)
uv run manage.py import_tvspot data/example_tvspot.json
The import_reference_data command processes its own internal dependencies: LLM Models, Regions, Languages, Countries, then M2M mappings.
Idempotency
All import commands use update_or_create() and are safe to run repeatedly. Natural keys used for matching:
Model |
Natural Key |
|---|---|
DiffusionModel |
|
LoraModel |
|
PromptTemplate |
|
Region / Country / Language |
|
LLMModel |
|
Segment |
|
Persona |
|
Brand |
|