Database Setup
EstateHub uses PostgreSQL in development and production. Test settings use SQLite. The root Compose stack specifies PostgreSQL 17; the backend uses the PostgreSQL Django database engine.
Prerequisites
A running PostgreSQL server, permission to create a database and application role, and an installed backend virtual environment.
Configure the Connection
Create a database and restricted application role using your database administration tool. Give the role access to the application's database and schema, then configure backend/.env:
DB_NAME=estatehub
DB_USER=estatehub_app
DB_PASSWORD=<replace-with-a-unique-password>
DB_HOST=127.0.0.1
DB_PORT=5432Django reads these separate fields, not DATABASE_URL. For hosted PostgreSQL, ensure the connection satisfies the provider's TLS requirements. The current settings have no explicit SSL option; use the PostgreSQL client's supported configuration or a reviewed settings customization when needed.
Initialize the Schema
From backend/, with its virtual environment active:
python manage.py migrate
python manage.py populate_checklists
python manage.py createsuperuser
python manage.py checkMigrations create the release schema. populate_checklists creates or updates the buy and lease progress definitions; createsuperuser creates an administrator with the required role.
Verify
Run python manage.py showmigrations and confirm the release migrations are applied. /health/ checks database connectivity. Test restores separately; do not treat a healthy connection as proof of a valid backup.
Compose Values
The root Compose file also interpolates DB_NAME, DB_USER, and DB_PASSWORD from its own environment or root .env. backend/.env alone does not supply these Compose interpolation values. Use matching credentials for PostgreSQL and Django.
See Backend Setup and Updating EstateHub.