metadata
title: Hue Portal Backend
affiliation: Cong An Thanh Pho Hue
colorFrom: green
colorTo: blue
sdk: docker
pinned: false
license: apache-2.0
Deployment Notes
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.
Environment variables required
Set the following secrets in Settings → Repository secrets before building the Space:
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string (Railway instance) with ?sslmode=require. |
DJANGO_SECRET_KEY |
Secret key for Django. |
DJANGO_ALLOWED_HOSTS |
e.g. *.hf.space,localhost. |
DEFAULT_LLM_PROVIDER, LLM_PROVIDER, etc. |
Optional overrides reused from the original .env. |
You can push these secrets via the helper script:
cp ops/hf.secrets.env.example ops/hf.secrets.env
# edit ops/hf.secrets.env with real values
export HF_TOKEN=hf_xxx # token with write access to the Space
python backend/scripts/update_hf_space_secrets.py \
--space davidttran999/hue-portal-backendDocker \
--secrets-file ops/hf.secrets.env
Startup process
entrypoint.sh automatically runs:
python hue_portal/manage.py migratepython hue_portal/manage.py createcachetablegunicorn hue_portal.hue_portal.wsgi:application --bind 0.0.0.0:7860
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.