管理端上传的纹理/模型/图标和用户头像属于运行时数据:服务器上运行时读的是 bind mount 的 /opt/cosmo/data/upload,仓库里这份不会被访问,却占了 47MB。现在整体 不再跟踪,本地工作区的文件原样保留。 注意: - 种子资源从此不再随 git 分发。新环境部署要把初始纹理/模型/图标导入 /opt/cosmo/data/upload,否则前台取不到图。 - 其他机器 git pull 后会删掉它们工作区里的 backend/upload,运行时不受影响。 - 只影响后续提交,47MB 仍留在 git 历史里。 |
||
|---|---|---|
| .. | ||
| app | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile | ||
| README.md | ||
| de421.bsp | ||
| pip.conf | ||
| requirements.txt | ||
README.md
Cosmo Backend
Backend API for the Cosmo deep space explorer visualization system.
Setup
- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- 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: http://localhost:8000/api
- Docs: http://localhost:8000/docs
- Health: http://localhost:8000/health
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