MCPcopy Create free account
hub / github.com/JasonBuildAI/GoldMind / main

Function main

backend/scripts/utils/init_project.py:23–446  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 print(f"✅ 创建文件: {filepath}")
22
23def main():
24 print("🚀 开始创建黄金市场分析系统项目...")
25 print("=" * 60)
26
27 # 1. 创建目录结构
28 directories = [
29 "app",
30 "app/models",
31 "app/schemas",
32 "app/routers",
33 "app/agents",
34 "app/services",
35 "app/utils",
36 "app/tasks",
37 ]
38
39 for dir_path in directories:
40 full_path = BACKEND_DIR / dir_path
41 full_path.mkdir(parents=True, exist_ok=True)
42 print(f"✅ 创建目录: {dir_path}")
43
44 print("\n" + "=" * 60)
45 print("📝 创建核心文件...")
46 print("=" * 60)
47
48 # 2. 创建 __init__.py 文件
49 init_files = [
50 "app/__init__.py",
51 "app/models/__init__.py",
52 "app/schemas/__init__.py",
53 "app/routers/__init__.py",
54 "app/agents/__init__.py",
55 "app/services/__init__.py",
56 "app/utils/__init__.py",
57 "app/tasks/__init__.py",
58 ]
59
60 for file_path in init_files:
61 create_file(BACKEND_DIR / file_path, '"""黄金市场分析系统"""')
62
63 # 3. 创建主应用文件
64 create_file(
65 BACKEND_DIR / "app/main.py",
66 '''"""FastAPI 主应用入口"""
67import os
68from contextlib import asynccontextmanager
69from fastapi import FastAPI
70from fastapi.middleware.cors import CORSMiddleware
71from loguru import logger
72
73from app.config import settings
74from app.database import engine, Base
75from app.routers import gold_prices, analysis, news, predictions
76from app.scheduler import init_scheduler, shutdown_scheduler
77
78
79@asynccontextmanager
80async def lifespan(app: FastAPI):

Callers 1

init_project.pyFile · 0.70

Calls 1

create_fileFunction · 0.85

Tested by

no test coverage detected