28 lines
810 B
Python
28 lines
810 B
Python
#!/usr/bin/env python3
|
|
"""Ручной запуск разового seed nutrients (обычно не нужен — выполняется при старте WESP)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from app import create_app
|
|
from app.lab.commands.seed_demo_component_nutrients import seed_demo_component_nutrients_once
|
|
|
|
|
|
def main() -> int:
|
|
force = "--force" in sys.argv
|
|
app = create_app()
|
|
with app.app_context():
|
|
result = seed_demo_component_nutrients_once(force=force)
|
|
print(result)
|
|
return 0 if result.get("seeded") or result.get("reason") == "already_done" else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|