aifeilong 13b1ca2b9b Namespace API routes by app and flatten package layout.
Move Django apps out of apps/ and mount them under auth/, common/, content/, and cms/ so endpoint paths map directly to the owning app.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 08:42:37 +08:00

39 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# STAR International API
Django + DRF backend for the STAR International site (independent from the domestic Java service).
## Setup
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py seed_demo
python manage.py createsuperuser # optional; local seed uses admin / admin123 if created
python manage.py runserver
```
Default local DB is SQLite via `config/local_settings.py`. For PostgreSQL, override `DATABASES` in `local_settings.py` or env vars.
## API
路由按 app 划分前缀(网关再统一挂 `/api`):
| 前缀 | App | 示例 |
|------|-----|------|
| `/api/auth/` | `accounts` | `POST /api/auth/login/`、`GET /api/auth/me/` |
| `/api/common/` | `common` | `POST /api/common/uploads/` |
| `/api/content/` | `content` | `/api/content/articles/`、`/api/content/columns/`、… |
| `/api/cms/` | `cms` | `/api/cms/news/`、`GET /api/cms/search/?q=` |
Django admin: `/django-admin/`
Staff write operations require `Authorization: Token <key>` and `is_staff=True`.
## Demo
```bash
python manage.py seed_demo
```