- python -m scripts.seed (module mode) fixes ModuleNotFoundError - Add scripts/__init__.py to make scripts/ a proper package - Generate initial Alembic migration for users table - Replace passlib with direct bcrypt>=4.0 (passlib unmaintained, broken with bcrypt 4.x) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.9 KiB
2026-04-12 — Troubleshoot dev stack startup
Timestamp: 2026-04-12T15:30:00
Summary
Fixed three startup failures discovered when running the dev stack for the first time.
Issues Fixed
-
ModuleNotFoundError: No module named 'app'—python scripts/seed.pydoes not add the working directory tosys.path. Changed topython -m scripts.seedwhich uses module mode and adds/appto the path. Addedbackend/scripts/__init__.pyto make the directory a package. -
relation "users" does not exist— No Alembic migration files existed, soalembic upgrade headwas a no-op. Generated the initial migration (38efeff7c45a_create_users_table.py) by runningalembic revision --autogenerateinside the backend container against the live database. -
ValueError: password cannot be longer than 72 bytes(passlib + bcrypt 4.x incompatibility) —passlibis unmaintained and its bcrypt wrap-bug detection raises an exception against bcrypt 4.x. Replacedpasslib[bcrypt]with directbcrypt>=4.0usage in bothpyproject.tomlandapp/core/security.py.
Smoke Test Results (all passing)
GET /api/health→{"status":"ok"}POST /api/auth/login→ JWT token issued fortest@example.comGET /api/users/me→ returns user profile with valid tokenPOST /api/auth/register→ new user created successfully- Weak password (
"password") → rejected with detailed validation errors - Frontend
http://localhost:5173→ HTTP 200
Files Added
backend/scripts/__init__.py— makes scripts/ a Python packagebackend/alembic/versions/38efeff7c45a_create_users_table.py— initial migration
Files Modified
backend/scripts/start_dev.sh—python scripts/seed.py→python -m scripts.seedbackend/pyproject.toml—passlib[bcrypt]>=1.7→bcrypt>=4.0backend/app/core/security.py— replaced passlib with direct bcrypt calls