mirror of
https://github.com/ZhuLinsen/daily_stock_analysis
synced 2026-09-20 02:43:35 +08:00
* feat(web): add FastAPI & React web connect * feat: add FastAPI package * feat: system base struct * feat: frontend base struct * feat: 基础分析接口,历史记录接口 * fix: 使用正确的 FastAPI 方法定义,避免线程阻塞 * fix: 对接历史报告页、详情页 * fix: 修复接口问题 * fix: 网络配置 允许公网访问 跨域配置 * fix: 页面打包 & 提供 Server 静态访问 * fix: 优化dock栏样式 * fix: 优化图标样式 * fix: 修改部分配色 * fix: 删除垃圾文档 * fix: 删除垃圾代码 * fix: 驼峰转换工具 * fix: 历史记录列表滚动加载(分页) * feat: 显示分析中任务 * fix: 调整布局 * fix: 优化 Market Sentiment 组件动效 * fix: 历史列表组件bug * fix: FastAPI 日志配置 * feat: 新闻历史接口 * feat: 资讯列表 * feat: 优化布局 * fix: 修复页面元素变宽问题 * fix: 中文标题 * fix: 任务列表状态显示问题 * fix: 抽取日志配置 * fix: 优化报告价格显示 * fix: 修复编译错误 * fix: FastAPI 启动提取到 main.py * fix: 补充新web-ui启动文档 * fix: 默认发送通知 * fix: FastAPI 模式适配 docker * fix: FastAPI 模式文档 * Update api/v1/endpoints/stocks.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: package-lock.json * fix: 修改错别字 * fix: 更新文档说明 * fix: 更新文档说明 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
55 lines
1.2 KiB
Python
55 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
===================================
|
|
Daily Stock Analysis - FastAPI 后端服务入口
|
|
===================================
|
|
|
|
职责:
|
|
1. 提供 RESTful API 服务
|
|
2. 配置 CORS 跨域支持
|
|
3. 健康检查接口
|
|
4. 托管前端静态文件(生产模式)
|
|
|
|
启动方式:
|
|
uvicorn server:app --reload --host 0.0.0.0 --port 8000
|
|
|
|
或使用 main.py:
|
|
python main.py --serve-only # 仅启动 API 服务
|
|
python main.py --serve # API 服务 + 执行分析
|
|
"""
|
|
|
|
import logging
|
|
|
|
from src.config import setup_env, get_config
|
|
from src.logging_config import setup_logging
|
|
|
|
# 初始化环境变量与日志
|
|
setup_env()
|
|
|
|
config = get_config()
|
|
level_name = (config.log_level or "INFO").upper()
|
|
level = getattr(logging, level_name, logging.INFO)
|
|
|
|
setup_logging(
|
|
log_prefix="api_server",
|
|
console_level=level,
|
|
extra_quiet_loggers=['uvicorn', 'fastapi'],
|
|
)
|
|
|
|
# 从 api.app 导入应用实例
|
|
from api.app import app # noqa: E402
|
|
|
|
# 导出 app 供 uvicorn 使用
|
|
__all__ = ['app']
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
|
|
uvicorn.run(
|
|
"server:app",
|
|
host="0.0.0.0",
|
|
port=8000,
|
|
reload=True,
|
|
)
|