Skip to content

Commit 5918e5b

Browse files
authored
Merge pull request #41 from bulolo/main
fix:load .env file
2 parents 4549861 + c07990d commit 5918e5b

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

backend/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ email-validator>=2.2.0 # Pydantic email 验证依赖
157157
# Logging
158158
loguru>=0.7.0
159159

160+
# Environment Variable Management
161+
python-dotenv>=1.0.0
162+
160163
# Office Document Parsing (MarkItDown backend)
161164
markitdown[all]>=0.1.3
162165

backend/start_all.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from pathlib import Path
2121
import argparse
2222
from utils import parse_list_arg
23+
from dotenv import load_dotenv
2324

2425

2526
class TianshuLauncher:
@@ -283,6 +284,14 @@ def wait(self):
283284

284285
def main():
285286
"""主函数"""
287+
env_path = Path(__file__).parent / ".env"
288+
if env_path.exists():
289+
load_dotenv(dotenv_path=env_path)
290+
logger.info(f"✅ Loaded .env from: {env_path}")
291+
else:
292+
logger.error(f"❌ .env file not found at: {env_path}")
293+
logger.error("Please create a .env file in the backend directory with required environment variables")
294+
sys.exit(1)
286295
parser = argparse.ArgumentParser(
287296
description="MinerU Tianshu - 统一启动脚本",
288297
formatter_class=argparse.RawDescriptionHelpFormatter,

0 commit comments

Comments
 (0)