修正引用路径;恢复project_info.py到service目录,新增config/project_info.yml配置文件

This commit is contained in:
2026-01-21 17:41:52 +08:00
parent 6c0f7d821c
commit 5986a20cc3
25 changed files with 50 additions and 28 deletions

View File

@@ -0,0 +1,22 @@
import os
import yaml
# 获取当前项目根目录的路径
_current_file = os.path.abspath(__file__)
project_root = os.path.dirname(os.path.dirname(os.path.dirname(_current_file)))
# 尝试读取 .yml 或 .yaml 文件
config_file = os.path.join(project_root, "configs", "project_info.yml")
if not os.path.exists(config_file):
config_file = os.path.join(project_root, "configs", "project_info.yaml")
if not os.path.exists(config_file):
raise FileNotFoundError(f"未找到项目配置文件 (project_info.yaml 或 .yml): {os.path.dirname(config_file)}")
with open(config_file, 'r', encoding='utf-8') as f:
_config = yaml.safe_load(f)
if not _config or 'name' not in _config:
raise KeyError(f"项目配置文件中缺少 'name' 配置: {config_file}")
name = _config['name']

View File

@@ -1,5 +1,5 @@
import numpy as np
from tjnetwork import *
from app.services.tjnetwork import *
from app.native.api.s36_wda_cal import *
# from get_real_status import *
@@ -19,10 +19,10 @@ import psycopg
import logging
import app.services.globals as globals
import uuid
import configs.project_info as project_info
import app.services.project_info as project_info
from app.native.api.postgresql_info import get_pgconn_string
from timescaledb.internal_queries import InternalQueries as TimescaleInternalQueries
from timescaledb.internal_queries import InternalStorage as TimescaleInternalStorage
from app.infra.db.timescaledb.internal_queries import InternalQueries as TimescaleInternalQueries
from app.infra.db.timescaledb.internal_queries import InternalStorage as TimescaleInternalStorage
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"