fix(seed): correct sys.path so seed_email_templates_core can import app.*
Some checks failed
CI / ruff (push) Successful in 16s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Script lived at scripts/seed/seed_email_templates_core.py and inserted
Path(__file__).parent.parent into sys.path — that resolves to
scripts/, not the project root, so `from app.core.database import get_db`
raises ModuleNotFoundError when run from inside the container.

The loyalty sibling already uses parent.parent.parent correctly.
Hit during the FR/DE password_reset reseed on prod.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 00:02:44 +02:00
parent 7e3a1cb93f
commit 213a60533c

View File

@@ -10,8 +10,8 @@ import json
import sys import sys
from pathlib import Path from pathlib import Path
# Add project root to path # Add project root to path (script is at scripts/seed/, project root is two levels up)
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent.parent))
# Register all models with SQLAlchemy so string-based relationships resolve # Register all models with SQLAlchemy so string-based relationships resolve
for _mod in [ for _mod in [