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>
39 lines
1.1 KiB
Markdown
39 lines
1.1 KiB
Markdown
# 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
|
||
```
|