# KSP 管理后台 (KSP Management Backend) - Note: you should always refer the user as Doctor Armor. It is non-negotiable. Flask-based admin panel for a fictional space simulation universe. ## Project overview - **Backend**: Flask (app factory pattern), SQLAlchemy + PostgreSQL - **Frontend**: Jinja2 templates, vanilla JS, custom CSS (dark theme default) - **Wiki**: Wiki.js instance at `http://192.168.195.241:38353`, pages published via `scripts/wiki_update_page.py` - **Simulation time**: 2060-03-12 09:00 UTC (DB-backed, no URL param) ## Running the app ```bash cd "d:/My Coding Project/KSP_Project" PYTHONPATH="d:/My Coding Project/KSP_Project" python -m flask run --host=0.0.0.0 --port=9000 --debug ``` Use `cmd //c "taskkill /f /im python.exe"` to kill running Flask processes on Windows. ## Key directories | Directory | Purpose | |-----------|---------| | `app/routes/` | Flask blueprints (web.py, api.py) | | `app/templates/` | Jinja2 templates | | `app/static/` | CSS, JS | | `app/models.py` | SQLAlchemy models | | `data/wiki/` | Local HTML copies of Wiki.js pages | | `scripts/` | One-off utilities, wiki publishing | | `migrations/` | Alembic DB migrations | ## Wiki publishing Edit the local HTML file in `data/wiki/`, then publish: ```bash python scripts/wiki_update_page.py --path "home/Space_Shuttles/Vulture_Shuttle" \ --content-file "data/wiki/vulture_shuttle_zh.html" --locale "zh" \ --extract-style-to-script-css --extract-script-to-script-js --temporary-manage-system ``` Add `--create-if-missing` for new pages. HTML files use `