59 lines
1.6 KiB
Markdown
59 lines
1.6 KiB
Markdown
# Spatial Image Enhancer Pro
|
|
|
|
Production-grade public SPA for spatial-domain image enhancement using Django REST Framework, OpenCV, NumPy, React, Tailwind CSS, Celery, Redis, PostgreSQL, Docker Compose, and Caddy.
|
|
|
|
## Local Development
|
|
|
|
Backend:
|
|
|
|
```bash
|
|
cd backend
|
|
python -m venv .venv
|
|
.venv\Scripts\activate
|
|
copy .env.sample .env
|
|
pip install -r requirements.txt
|
|
python manage.py migrate
|
|
python manage.py runserver
|
|
```
|
|
|
|
Frontend:
|
|
|
|
```bash
|
|
cd frontend
|
|
copy .env.sample .env
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
Open `http://localhost:5173`. The frontend `.env` uses `VITE_API_BASE=http://localhost:8000`, and the backend `.env` allows that origin via CORS/CSRF settings.
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
copy .env.example .env
|
|
copy backend\.env.sample backend\.env
|
|
docker compose up --build
|
|
```
|
|
|
|
Caddy serves the SPA and proxies `/api/*` and `/media/*`. Set `CADDY_DOMAIN`, `DJANGO_ALLOWED_HOSTS`, `DJANGO_CSRF_TRUSTED_ORIGINS`, `CORS_ALLOWED_ORIGINS`, and a strong `DJANGO_SECRET_KEY` before production deployment.
|
|
|
|
For production, use `.env.sample` as the root Compose template and `backend/.env.production.sample` as the backend-only template.
|
|
|
|
## Backend Structure
|
|
|
|
The Django app follows the HackSoftware Django Styleguide pattern:
|
|
|
|
- API views validate request input and return responses.
|
|
- `processing/services.py` contains business workflows and writes.
|
|
- `processing/selectors.py` contains database fetch helpers.
|
|
- Settings are environment-driven through `backend/.env`.
|
|
|
|
## API
|
|
|
|
- `POST /api/images/`
|
|
- `POST /api/process/`
|
|
- `POST /api/batch/`
|
|
- `GET /api/jobs/{job_id}/`
|
|
|
|
Images are stored as ephemeral sessions and removed by the cleanup task after the configured TTL.
|