cosmo/backend
mula.liu 24e191f991 将 backend/upload 排除出 git
管理端上传的纹理/模型/图标和用户头像属于运行时数据:服务器上运行时读的是 bind
mount 的 /opt/cosmo/data/upload,仓库里这份不会被访问,却占了 47MB。现在整体
不再跟踪,本地工作区的文件原样保留。

注意:
- 种子资源从此不再随 git 分发。新环境部署要把初始纹理/模型/图标导入
  /opt/cosmo/data/upload,否则前台取不到图。
- 其他机器 git pull 后会删掉它们工作区里的 backend/upload,运行时不受影响。
- 只影响后续提交,47MB 仍留在 git 历史里。
2026-10-08 00:21:22 +08:00
..
app 加入对esp32客户端的支持 2026-10-08 00:07:59 +08:00
.dockerignore v 1.0.1 2025-12-02 21:25:28 +08:00
.env.example 大幅调整的一个版本,待测试 2025-12-04 20:37:10 +08:00
.gitignore 初步完成了太阳系内的行星显示 2025-11-27 13:16:19 +08:00
Dockerfile 1.0.5 2025-12-29 09:22:51 +08:00
README.md 初步完成了太阳系内的行星显示 2025-11-27 13:16:19 +08:00
de421.bsp 增加了定时任务 2025-12-26 09:21:15 +08:00
pip.conf 优化了部署文件,使用国内镜像 2025-12-02 22:18:32 +08:00
requirements.txt 1.0.3 2025-12-27 18:50:07 +08:00

README.md

Cosmo Backend

Backend API for the Cosmo deep space explorer visualization system.

Setup

  1. Create virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Copy environment file:
cp .env.example .env

Running

Start the development server:

cd backend
python -m app.main

Or using uvicorn directly:

uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

The API will be available at:

API Endpoints

Get Celestial Positions

GET /api/celestial/positions

Query parameters:

  • start_time: ISO 8601 datetime (optional)
  • end_time: ISO 8601 datetime (optional)
  • step: Time step, e.g., "1d", "12h" (default: "1d")

Example:

http://localhost:8000/api/celestial/positions?start_time=2025-01-01T00:00:00Z&end_time=2025-01-10T00:00:00Z&step=1d

Get Body Info

GET /api/celestial/info/{body_id}

Example:

http://localhost:8000/api/celestial/info/-31

List All Bodies

GET /api/celestial/list

Clear Cache

POST /api/celestial/cache/clear