Files

30 lines
840 B
Python

"""
Run all setup tasks using subprocess, but the scripts themselves do the DB work
"""
import subprocess
import sys
import os
backend_dir = '/root/cma-management/backend'
python = sys.executable
# Task 1: Insert data source
print("=" * 60)
print("子任务1: 插入数据源记录到 data_source_config")
print("=" * 60)
r = subprocess.run([python, 'scripts/_task1_insert_source.py'], cwd=backend_dir, capture_output=True, text=True)
print(r.stdout)
if r.returncode != 0:
print(f"ERROR: {r.stderr}")
sys.stdout.flush()
# Task 4: Create Excel template
print("=" * 60)
print("子任务4: 创建Excel导入模板")
print("=" * 60)
r = subprocess.run([python, 'scripts/_task4_create_template.py'], cwd=backend_dir, capture_output=True, text=True)
print(r.stdout)
if r.returncode != 0:
print(f"ERROR: {r.stderr}")
sys.stdout.flush()