Skip to content

Inertia setup looks for host/templates/ but sm new writes templates/ at project root — boot fails #108

Description

@antosubash

Summary

sm new generates templates/index.html at the project root, but simple_module_hosting._inertia_setup only looks for <project_root>/host/templates. With the scaffold's default layout, the host has no usable template directory and boot fails with RuntimeError: Inertia not configured — no template directories available.

Reproduction

uvx --from simple_module_cli sm new my-app --db sqlite --preset standard -y --no-install
cd my-app
# (after working around #105/#106/#107)
make install
make migrate
uv run python -c "from main import app"

Boot output:

WARNING simple_module_hosting._inertia_setup: Host templates directory not found at /.../my-app/host/templates
WARNING simple_module_hosting._inertia_setup: No usable template directories — Inertia will fail to render views
...
File ".../site-packages/simple_module_hosting/app_builder.py", line 258, in create_app
raise RuntimeError("Inertia not configured — no template directories available")
RuntimeError: Inertia not configured — no template directories available

Source reference

simple_module_hosting/_inertia_setup.py:35

host_templates=project_root/"host"/"templates"
...
ifhost_templates.is_dir():
directories.append(host_templates)
else:
logger.warning("Host templates directory not found at %s", host_templates)

Scaffold output (actual layout)

my-app/
├── client_app/
├── main.py
├── migrations/
├── templates/ ← scaffold writes here
│ └── index.html
└── ...

Suggested fix

One of:

  1. Have sm new write the template to host/templates/index.html to match what the framework looks up.
  2. Have _inertia_setup accept root templates/ as a fallback (less surprising to anyone reading the project layout — host/templates is an unusual location).
  3. Make the host templates path configurable via SM_HOST_TEMPLATES_DIR and document it.

Workaround

mkdir -p host
mv templates host/templates

Environment

  • simple_module_cli, simple_module_hosting 0.0.6
  • macOS 25.4.0 (arm64), Python 3.12.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions