fix: Add backend directory to Python path for proper imports
This commit is contained in:
@@ -6,6 +6,7 @@ ASR: 阿里云听悟 + OSS
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import httpx
|
||||
import uuid
|
||||
@@ -17,6 +18,11 @@ from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
# Add backend directory to path for imports
|
||||
backend_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
if backend_dir not in sys.path:
|
||||
sys.path.insert(0, backend_dir)
|
||||
|
||||
# Import clients
|
||||
try:
|
||||
from oss_uploader import get_oss_uploader
|
||||
@@ -33,7 +39,8 @@ except ImportError:
|
||||
try:
|
||||
from db_manager import get_db_manager, Project, Entity, EntityMention
|
||||
DB_AVAILABLE = True
|
||||
except ImportError:
|
||||
except ImportError as e:
|
||||
print(f"DB import error: {e}")
|
||||
DB_AVAILABLE = False
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user