Skip to content

Getting Started with Real Estate Investor

This tutorial will walk you through setting up the Real Estate Investor application and creating your first property analysis.

Prerequisites

Before you begin, ensure you have:

  • Python 3.11 or higher installed
  • Git installed
  • Basic familiarity with command-line interfaces
  • (Optional) Docker and Docker Compose for containerized deployment

Step 1: Clone the Repository

First, clone the repository to your local machine:

git clone git@github.com:paruff/prei.git
cd prei

Step 2: Set Up Your Environment

Option A: Local Development with Virtual Environment

Create and activate a Python virtual environment:

python3.11 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

Install the required dependencies:

pip install -r requirements.txt

If you prefer containerized development, you can use Docker Compose:

docker-compose up --build

This will start both the web application and PostgreSQL database.

Step 3: Configure Environment Variables

Copy the example environment file and customize it:

cp .env.example .env

Edit the .env file to set your configuration:

DEBUG=True
SECRET_KEY=your-secure-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1

# For local development (SQLite)
# Leave DATABASE_URL commented out to use SQLite

# For PostgreSQL (local)
# DATABASE_URL=postgres://postgres:postgres@localhost:5432/investor_db

# For Docker Compose
DATABASE_URL=postgres://postgres:postgres@db:5432/investor_db

Important: Generate a secure SECRET_KEY using:

python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Step 4: Initialize the Database

Run Django migrations to set up the database schema:

# Local development
python manage.py migrate

# Docker Compose
docker-compose exec web python manage.py migrate

Step 5: Create a Superuser

Create an admin account to access the Django admin interface:

# Local development
python manage.py createsuperuser

# Docker Compose
docker-compose exec web python manage.py createsuperuser

Follow the prompts to set your username, email, and password.

Step 6: Load Sample Data (Optional)

To get started quickly, you can load sample property data:

# Local development
python manage.py import_csv data/properties.csv data/rents.csv data/expenses.csv

# Docker Compose
docker-compose exec web python manage.py import_csv data/properties.csv data/rents.csv data/expenses.csv

Step 7: Start the Development Server

Launch the Django development server:

# Local development
python manage.py runserver

# Docker Compose (already running)
# Access at http://localhost:8000

The application will be available at http://localhost:8000.

Step 8: Access the Application

  1. Admin Interface: Navigate to http://localhost:8000/admin and log in with your superuser credentials
  2. Dashboard: Visit http://localhost:8000/ to see the main dashboard (if implemented)

Step 9: Add Your First Property

In the Django admin interface:

  1. Click on Properties
  2. Click Add Property
  3. Fill in the property details:
  4. Address, city, state, zip code
  5. Purchase price and date
  6. Square footage and number of units (optional)
  7. Save the property

Step 10: Add Rental Income

  1. From the property's page, add Rental Income:
  2. Monthly rent amount
  3. Effective date
  4. Vacancy rate (defaults to 0.05 or 5%)

Step 11: Add Operating Expenses

  1. Add Operating Expenses for the property:
  2. Category (e.g., Property Tax, Insurance, Maintenance)
  3. Amount
  4. Frequency (Monthly or Annual)
  5. Effective date

Step 12: View Investment Analysis

The system automatically calculates investment metrics for each property:

  • NOI (Net Operating Income): Annual income minus operating expenses
  • Cap Rate: Return on investment based on NOI
  • Cash-on-Cash: Cash return on cash invested
  • IRR (Internal Rate of Return): Time-weighted return
  • DSCR (Debt Service Coverage Ratio): Ability to cover debt payments

Access these metrics through the Django admin or API endpoints.

Next Steps

Now that you have the application running, explore these guides:

Troubleshooting

Database Connection Issues

If you encounter database connection errors:

  • Local: Ensure PostgreSQL is running, or remove DATABASE_URL from .env to use SQLite
  • Docker: Verify the database service is healthy with docker-compose ps

Migration Errors

If migrations fail:

# Check migration status
python manage.py showmigrations

# Reset migrations (development only!)
python manage.py migrate core zero
python manage.py migrate

Port Already in Use

If port 8000 is already in use:

# Use a different port
python manage.py runserver 8001

Getting Help

If you encounter issues not covered here, please: