Skip to content

Development Setup

This guide explains how to set up a development environment for ReversePilot.

Prerequisites

  • Python 3.8 or higher
  • pip (Python package manager)
  • Git
  • Virtual environment tool (venv or virtualenv)
  • PostgreSQL (for production-like development) or SQLite (for simple development)

Initial Setup

1. Clone the Repository

git clone <repository-url>
cd dc_los_django

2. Create Virtual Environment

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

3. Install Dependencies

pip install -r requirements.txt

For development dependencies:

pip install -r requirements/dev.txt

4. Environment Configuration

Create a .local-env file in the project root:

ENV=LOCAL
DEBUG=True
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///db.sqlite3

For PostgreSQL:

ENV=DEV
DB_NAME=reversepilot_dev
DB_USER=postgres
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432

5. Database Setup

For SQLite (default):

python manage.py migrate

For PostgreSQL:

createdb reversepilot_dev
python manage.py migrate

6. Create Superuser

python manage.py createsuperuser

7. Run Development Server

python manage.py runserver

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

Development Tools

Pre-commit Hooks

Install pre-commit hooks:

pip install pre-commit
pre-commit install

Run manually:

pre-commit run --all-files

Code Formatting

The project uses Black for code formatting:

black .

Running Tests

pytest

Or with coverage:

pytest --cov

Project Structure

dc_los_django/
├── company/          # Company and user management
├── loan/            # Loan management
├── documents/       # Document generation
├── apps/
│   ├── credit_report/
│   └── fha_integration/
├── dc_los_django/   # Project settings
├── manage.py
└── requirements.txt

Common Development Tasks

Creating Migrations

python manage.py makemigrations
python manage.py migrate

Creating a New App

python manage.py startapp app_name

Accessing Django Shell

python manage.py shell

Running Management Commands

python manage.py <command>

IDE Setup

VS Code

Recommended extensions: - Python - Black Formatter - Django - Pylance

Settings (.vscode/settings.json):

{
  "editor.formatOnSave": true,
  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter"
  }
}

PyCharm

  • Configure Django support
  • Set up Black formatter
  • Configure test runner

Database Management

SQLite (Development)

  • Default database for local development
  • No additional setup required
  • File: db.sqlite3

PostgreSQL (Production-like)

  1. Install PostgreSQL
  2. Create database
  3. Update .local-env with database credentials
  4. Run migrations

API Documentation

Swagger UI

Access at: http://localhost:8000/swagger/

ReDoc

Access at: http://localhost:8000/redoc/

Troubleshooting

Import Errors

  • Ensure virtual environment is activated
  • Verify all dependencies are installed
  • Check Python path

Database Errors

  • Verify database is running
  • Check database credentials
  • Run migrations

Port Already in Use

python manage.py runserver 8001

Next Steps


For development questions, contact the development team.