A community powered flood intelligence platform, that creates awareness for citizen by showing affected areas and their severity. Built for Ghana
# Flood Intelligence Platform — Backend
Django 5 + Django REST Framework API for the Flood Intelligence Platform, a civic-tech
flood-reporting and verification platform for Accra, Ghana.
See `docs/DATA_MODEL.md` for the data model, service-layer
architecture, endpoint list, and role permissions (this stands in for the project brief,
which was not available at build time — see the note at the top of that file).
## Stack
- Django 5 + Django REST Framework
- SQLite (MVP datastore; swappable via `DATABASE_URL`)
- JWT auth via `djangorestframework-simplejwt`
- Cloudinary for media storage in production (via `apps.media` abstraction); local
filesystem storage in dev/tests
- `drf-spectacular` for OpenAPI schema + Swagger docs
- ruff + black for linting/formatting, pytest + pytest-django for tests
## Setup
```bash
python -m venv venv
./venv/Scripts/activate # Windows
source venv/bin/activate # macOS/Linux
pip install -r requirements/dev.txt
cp .env.example .env # fill in secrets as needed
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```
The dev server uses `config.settings.dev` (set as the default in `manage.py`). Production
entry points (`config/wsgi.py`, `config/asgi.py`) default to `config.settings.prod`.
## Environment variables
See `.env.example` for the full list. Key ones:
| Variable | Purpose |
|---|---|
| `DJANGO_SECRET_KEY` | Django secret key — must be set to a random value outside local dev |
| `DEBUG` | `True`/`False` |
| `DJANGO_ALLOWED_HOSTS` | Comma-separated allowed hosts |
| `DATABASE_URL` | Defaults to local SQLite if unset |
| `CORS_ALLOWED_ORIGINS` | Comma-separated origins allowed to call the API (the frontend's URL) |
| `CLOUDINARY_CLOUD_NAME` / `CLOUDINARY_API_KEY` / `CLOUDINARY_API_SECRET` | Cloudinary media storage credentials |
## Project layout
```
config/ Django project package (settings/, urls.py, wsgi.py, asgi.py)
settings/
base.py shared s …