fix(v2): two regressions surfaced by the local smoke test
Both came from the src/ restructure and only show up at runtime, so
the test suite had not caught them.
- src/backend/config.py: env_file was "../../.env", which pydantic-
settings resolves against the *cwd*, not the file. Running uvicorn
or alembic from the project root therefore looked for
../../.env one level above the repo and silently fell back to the
default DB_PASSWORD ("change_me_in_production"), hiding the real
password. Now resolved as Path(__file__).resolve().parents[2] /
".env" so the lookup is always against the project root regardless
of cwd.
- src/backend/models/orm/__init__.py: Station and
StationRecipeAssignment were never imported here, so anything that
triggers Base.metadata.create_all without first importing the
setup router (which has its own Station import) ended up with no
stations / station_recipe_assignments tables. Verified locally:
/api/setup/seed used to fail with "Table tiemeasureflow.stations
doesn't exist" before this fix.
- .gitignore: ignore src/frontend/flask_app/package.json and
package-lock.json (local npm-install artifacts; the Dockerfile
installs tailwindcss directly).
Smoke verified end-to-end: uvicorn + gunicorn + MySQL, login + admin
stations + select_recipe + admin users all 200 OK.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,8 @@ src/frontend/flask_app/static/css/tailwind.css
|
|||||||
|
|
||||||
# Node
|
# Node
|
||||||
node_modules/
|
node_modules/
|
||||||
|
src/frontend/flask_app/package.json
|
||||||
|
src/frontend/flask_app/package-lock.json
|
||||||
|
|
||||||
# Flask-Babel compiled
|
# Flask-Babel compiled
|
||||||
*.mo
|
*.mo
|
||||||
@@ -70,3 +72,4 @@ nul
|
|||||||
|
|
||||||
# Competitor analysis (local only)
|
# Competitor analysis (local only)
|
||||||
Concorrente/
|
Concorrente/
|
||||||
|
docker-compose.override.yml
|
||||||
|
|||||||
@@ -57,8 +57,13 @@ class Settings(BaseSettings):
|
|||||||
# Path(__file__) = src/backend/config.py → parents[2] = project root
|
# Path(__file__) = src/backend/config.py → parents[2] = project root
|
||||||
return Path(__file__).resolve().parents[2] / self.upload_dir
|
return Path(__file__).resolve().parents[2] / self.upload_dir
|
||||||
|
|
||||||
# ../../.env reaches the project root from src/backend/.
|
# Always resolve .env against the project root regardless of cwd
|
||||||
model_config = {"env_file": "../../.env", "env_file_encoding": "utf-8", "extra": "ignore"}
|
# (pydantic-settings would otherwise treat the path as cwd-relative).
|
||||||
|
model_config = {
|
||||||
|
"env_file": str(Path(__file__).resolve().parents[2] / ".env"),
|
||||||
|
"env_file_encoding": "utf-8",
|
||||||
|
"extra": "ignore",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from src.backend.models.orm.task import RecipeTask, RecipeSubtask
|
|||||||
from src.backend.models.orm.measurement import Measurement
|
from src.backend.models.orm.measurement import Measurement
|
||||||
from src.backend.models.orm.access_log import AccessLog
|
from src.backend.models.orm.access_log import AccessLog
|
||||||
from src.backend.models.orm.setting import SystemSetting, RecipeVersionAudit
|
from src.backend.models.orm.setting import SystemSetting, RecipeVersionAudit
|
||||||
|
from src.backend.models.orm.station import Station, StationRecipeAssignment
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"User",
|
"User",
|
||||||
@@ -16,4 +17,6 @@ __all__ = [
|
|||||||
"AccessLog",
|
"AccessLog",
|
||||||
"SystemSetting",
|
"SystemSetting",
|
||||||
"RecipeVersionAudit",
|
"RecipeVersionAudit",
|
||||||
|
"Station",
|
||||||
|
"StationRecipeAssignment",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user