Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,49 +1,45 @@
|
|
| 1 |
---
|
| 2 |
title: Hue Portal Backend
|
| 3 |
-
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
-
sdk_version: "0.0.1"
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
##
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
cd backend/hue_portal
|
| 21 |
-
source ../venv/bin/activate
|
| 22 |
-
python manage.py migrate
|
| 23 |
-
python manage.py seed_default_users
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
Các biến môi trường hỗ trợ tuỳ biến (tùy chọn):
|
| 27 |
|
| 28 |
-
|
|
| 29 |
-
|
| 30 |
-
| `
|
| 31 |
-
| `
|
| 32 |
-
| `
|
| 33 |
-
| `
|
| 34 |
-
| `DEFAULT_USER_EMAIL` | `[email protected]` |
|
| 35 |
-
| `DEFAULT_USER_PASSWORD` | `User@123` |
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
###
|
| 45 |
|
| 46 |
-
|
| 47 |
-
- Frontend hiển thị nút “Đăng nhập” ở trang chủ và trên thanh điều hướng. Khi đăng nhập thành công sẽ hiển thị tên + role, kèm nút “Đăng xuất”.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Hue Portal Backend
|
| 3 |
+
affiliation: Cong An Thanh Pho Hue
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
---
|
| 10 |
|
| 11 |
+
## Deployment Notes
|
| 12 |
|
| 13 |
+
This Space packages the Django backend (OCR + RAG stack) from the `TryHarDemNayProject` repo. It installs the full backend inside the container and exposes the API on port **7860** via Gunicorn.
|
| 14 |
|
| 15 |
+
### Environment variables required
|
| 16 |
|
| 17 |
+
Set the following secrets in **Settings → Repository secrets** before building the Space:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
| Variable | Description |
|
| 20 |
+
|----------|-------------|
|
| 21 |
+
| `DATABASE_URL` | PostgreSQL connection string (Railway instance) with `?sslmode=require`. |
|
| 22 |
+
| `DJANGO_SECRET_KEY` | Secret key for Django. |
|
| 23 |
+
| `DJANGO_ALLOWED_HOSTS` | e.g. `*.hf.space,localhost`. |
|
| 24 |
+
| `DEFAULT_LLM_PROVIDER`, `LLM_PROVIDER`, etc. | Optional overrides reused from the original `.env`. |
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
You can push these secrets via the helper script:
|
| 27 |
|
| 28 |
+
```bash
|
| 29 |
+
cp ops/hf.secrets.env.example ops/hf.secrets.env
|
| 30 |
+
# edit ops/hf.secrets.env with real values
|
| 31 |
+
export HF_TOKEN=hf_xxx # token with write access to the Space
|
| 32 |
+
python backend/scripts/update_hf_space_secrets.py \
|
| 33 |
+
--space davidttran999/hue-portal-backendDocker \
|
| 34 |
+
--secrets-file ops/hf.secrets.env
|
| 35 |
+
```
|
| 36 |
|
| 37 |
+
### Startup process
|
| 38 |
|
| 39 |
+
`entrypoint.sh` automatically runs:
|
|
|
|
| 40 |
|
| 41 |
+
1. `python hue_portal/manage.py migrate`
|
| 42 |
+
2. `python hue_portal/manage.py createcachetable`
|
| 43 |
+
3. `gunicorn hue_portal.hue_portal.wsgi:application --bind 0.0.0.0:7860`
|
| 44 |
|
| 45 |
+
Logs are streamed in the Space console. If migrations fail because the DB already contains the schema, re-run after fixing credentials or drop the DB manually.
|