Backend for the Ethiopian Red Cross Society (ERCS) Emergency Operations Center (EOC). It provides a Strawberry GraphQL API (async ASGI) consumed by the React frontend.
- Python 3.12 / Django 5.1
- PostgreSQL 17
- Strawberry GraphQL (
strawberry-graphql-django ~0.70.1) - Docker Compose for local development
- Docker and Docker Compose
Copy the example env file and update the values:
cp .env.example .envOpen .env and set at minimum:
DJANGO_SECRET_KEY=your-secret-key-here
# Must be "db" when running inside Docker Compose
POSTGRES_HOST=dbThe following variables are required and have defaults set in docker-compose.yml for local dev — override them in .env if needed:
| Variable | Default (dev) | Notes |
|---|---|---|
APP_TYPE |
WEB |
Must be WEB |
APP_ENVIRONMENT |
DEV |
|
APP_DOMAIN |
http://localhost:8000 |
|
FRONTEND_DOMAIN |
http://localhost:3000 |
|
SESSION_COOKIE_DOMAIN |
localhost |
|
CSRF_COOKIE_DOMAIN |
localhost |
|
CELERY_REDIS_URL |
redis://redis:6379/0 |
Required when running the Celery worker |
docker compose upThis starts the web server on http://localhost:8000, a PostgreSQL database, a Redis instance, and a Celery worker.
docker compose run --rm web ./manage.py migratedocker compose run --rm web ./manage.py createsuperuserYou will be prompted for an email, full name, and password. The superuser will have the SUPERADMIN role and full access to the Django admin at http://localhost:8000/admin/.
The seed_data/db.json fixture contains an initial admin user and a set of external dashboards (Power BI embeds) for the Capacity & Resources section.
docker compose run --rm web ./manage.py loaddata seed_data/db.jsonNote: The fixture includes a pre-created admin account (
admin@togglecorp.com). If you have already created a superuser with the same email, the load will fail due to a conflict — either delete the existing user first or skip loading the user fixture.
Administrative areas (country, regions, zones) are sourced from the IFRC GO API and must be synced before the app is fully functional.
docker compose run --rm web ./manage.py sync_geoThis upserts Ethiopia's administrative hierarchy (COUNTRY → REGION → ZONE) keyed on IFRC GO IDs. It is safe to re-run — existing rows are updated in place.
To preview changes without writing to the database:
docker compose run --rm web ./manage.py sync_geo --dry-runNote: Woreda-level areas are not available from IFRC GO and must be seeded separately.
The GraphQL endpoint is available at:
http://localhost:8000/graphql/
docker compose run --rm web ./manage.py graphql_schema --out schema.graphqldocker compose run --rm web bash misc/run_tests.shThis runs pytest with coverage. Test files live in apps/<app>/tests/.
Pre-commit hooks are configured with ruff for linting and formatting.
uv run pre-commit run --all-files| App | Purpose |
|---|---|
users |
Custom user model, authentication, roles (Viewer / Staff / Superadmin) |
reports |
Reports, manuals, policies, guidelines, links, AI document extraction |
dashboards |
External dashboards (Power BI embeds), capacity & resource groups |
geo |
Geographic areas (regions, woredas) |
teams |
Teams and team members |
emergency |
Emergency events |
gallery |
Media gallery |
content |
CMS-style content |
common |
Shared utilities |