EstateHub

Backend Setup

Install the Django backend in backend/. You need Python 3.12, PostgreSQL, and the supplied source code. See Database Setup and Frontend Setup for the other application layers.

1. Prepare PostgreSQL

Create a database and a restricted application user. The Django settings read DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, and DB_PORT;

Keep the database name, user, password, host, and port ready for the backend environment file. See Configuration for the complete key inventory.

2. Install Python Dependencies

In the first terminal, from the workspace root:

BASH
cd backend
python -m venv .venv

Activate the environment:

  • Windows PowerShell: .venv\Scripts\Activate.ps1
  • macOS/Linux: source .venv/bin/activate

Then install the backend dependencies:

BASH
python -m pip install -r requirements.txt

3. Initialize the Backend

Create backend/.env with your database connection and a unique development secret. For a local PostgreSQL server, the following shows the required keys; replace the placeholder values:

DOTENV
SECRET_KEY=<unique-development-secret>
ALLOWED_HOSTS=127.0.0.1,localhost
DB_NAME=<database-name>
DB_USER=<database-user>
DB_PASSWORD=<database-password>
DB_HOST=127.0.0.1
DB_PORT=5432
CORS_ALLOWED_ORIGINS=http://localhost:3000
CSRF_TRUSTED_ORIGINS=http://localhost:3000

manage.py defaults to core.settings.dev; set DJANGO_SETTINGS_MODULE=core.settings.dev explicitly if your environment overrides it. The frontend runs on localhost:3000, so its origin must be allowed by the backend.

With PostgreSQL running, initialize the backend:

BASH
python manage.py migrate
python manage.py populate_checklists
python manage.py createsuperuser
python manage.py check

populate_checklists is an idempotent command that creates the buy and lease progress definitions used by reservation-payment verification. createsuperuser asks for an email and full name; the custom user manager assigns the admin role, is_staff, and is_superuser.

4. Run the Backend Locally

BASH
python manage.py runserver 127.0.0.1:8000

Verify these backend URLs:

URLExpected result
http://127.0.0.1:8000/health/HTTP 200 when Django can connect to PostgreSQL
http://127.0.0.1:8000/admin/Django administration login
http://127.0.0.1:8000/api/docs/Generated Swagger discovery UI; schema warnings still apply
http://127.0.0.1:8000/api/v1/customers/properties/Public paginated property response

Optional Demonstration Data

python manage.py seed_demo_data installs repeatable US demonstration users, properties, payments, appointments, and messages. It also resets all demonstration users to the fixed password embedded in the command.

Never seed production

Run seed_demo_data only in a disposable local or test database. The command creates predictable credentials and synthetic business records.

Expected Result

The backend responds at /health/, migrations are applied, checklist definitions are initialized, and the first administrator can sign in. For realtime testing, run daphne -b 127.0.0.1 -p 8000 core.asgi:application instead of the development server.

Important Notes

The root compose.yaml declares frontend, backend, PostgreSQL, Redis, and Celery services. Its backend command uses core.asgi:application. For production, configure the startup command, collect static files, set up HTTPS/proxy handling, and use durable file storage. Verify cache and realtime connections for your deployment.

Frontend Setup, Environment Variables, Backend Initialization, and Production Deployment.