This guide will help you set up a local development environment for PropManager.
- Prerequisites
- Installation
- Configuration
- Running the Application
- Development Tools
- Testing
- Common Tasks
| Software | Version | Purpose |
|---|---|---|
| Python | 3.11+ | Application runtime |
| PostgreSQL | 14+ | Database |
| Redis | 6+ | Cache and task queue |
| Git | 2.x | Version control |
| Software | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Frontend asset compilation (if modifying) |
| Docker | 24+ | Containerized development |
- 4GB RAM minimum (8GB recommended)
- 2GB free disk space
- macOS, Linux, or Windows with WSL2
git clone https://github.com/yourusername/propmanager.git
cd propmanager# Create virtual environment
python -m venv venv
# Activate (Linux/macOS)
source venv/bin/activate
# Activate (Windows)
venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txt# Create database and user
sudo -u postgres psql
postgres=# CREATE USER propmanager WITH PASSWORD 'your_password';
postgres=# CREATE DATABASE propmanager OWNER propmanager;
postgres=# GRANT ALL PRIVILEGES ON DATABASE propmanager TO propmanager;
postgres=# \q# Start Redis (Ubuntu/Debian)
sudo systemctl start redis
# Start Redis (macOS with Homebrew)
brew services start redis
# Verify Redis is running
redis-cli ping
# Should return: PONGCopy the example environment file:
cp .env.example .envEdit .env with your local settings:
# Database
DATABASE_URL=postgres://propmanager:your_password@localhost:5432/propmanager
# Django
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Redis
REDIS_URL=redis://localhost:6379/0
# Email (use console backend for development)
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackendpython -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"For quick local development, these are the essential settings:
# .env minimum
DATABASE_URL=postgres://propmanager:password@localhost:5432/propmanager
SECRET_KEY=dev-secret-key-change-in-production
DEBUG=True
REDIS_URL=redis://localhost:6379/0
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackendpython manage.py migratepython manage.py createsuperuserFollow the prompts to set email and password.
python manage.py seed_dev_dataThis creates:
- Sample properties and units
- Test tenant accounts
- Invoices and payment history
- Work orders
- Various tenant scenarios for testing
python manage.py runserverAccess the application:
- Admin Portal: http://localhost:8000/admin-portal/
- Tenant Portal: http://localhost:8000/tenant/
- Django Admin: http://localhost:8000/admin/
In a separate terminal:
source venv/bin/activate
python manage.py qclusterThis runs the Django-Q2 task queue for background jobs.
PropManager uses Black and isort for consistent code formatting:
# Format all Python files
black .
# Sort imports
isort .# Run flake8
flake8
# Run with specific config
flake8 --config=.flake8Install pre-commit for automatic checks:
pip install pre-commit
pre-commit installDebug toolbar is enabled in development. Access it via the sidebar on any page.
Useful panels:
- SQL - Database queries
- Templates - Template rendering
- Cache - Cache operations
- Signals - Signal dispatching
Helpful management commands:
# Interactive shell with auto-imports
python manage.py shell_plus
# Show all URLs
python manage.py show_urls
# Generate model graph
python manage.py graph_models -a -o models.png# Run all tests
python manage.py test
# Run specific app tests
python manage.py test apps.billing
# Run specific test class
python manage.py test apps.billing.tests.InvoiceTests
# Run with verbosity
python manage.py test -v 2# Run tests with coverage
coverage run --source='.' manage.py test
# Generate report
coverage report
# Generate HTML report
coverage html
# Open htmlcov/index.html in browserPlace tests in tests/ directory within each app:
apps/billing/
├── tests/
│ ├── __init__.py
│ ├── test_models.py
│ ├── test_views.py
│ └── test_tasks.py
Example test:
from django.test import TestCase
from apps.billing.models import Invoice
from apps.leases.models import Lease
class InvoiceModelTest(TestCase):
def setUp(self):
# Create test data
self.lease = Lease.objects.create(...)
def test_invoice_creation(self):
invoice = Invoice.objects.create(
lease=self.lease,
amount=1000.00
)
self.assertEqual(invoice.status, 'draft')
def test_late_fee_calculation(self):
# Test late fee logic
pass# Create app in apps directory
python manage.py startapp newapp apps/newapp
# Add to INSTALLED_APPS in settings.py
INSTALLED_APPS = [
...
'apps.newapp',
]# After modifying models
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Check migration SQL without applying
python manage.py sqlmigrate app_name 0001# Drop and recreate database (development only!)
sudo -u postgres psql -c "DROP DATABASE propmanager;"
sudo -u postgres psql -c "CREATE DATABASE propmanager OWNER propmanager;"
# Run migrations fresh
python manage.py migrate
# Reload seed data
python manage.py seed_dev_dataWith console email backend, emails are printed to the terminal. For a more realistic experience:
# Use MailHog (install separately)
# Then set in .env:
EMAIL_HOST=localhost
EMAIL_PORT=1025Access MailHog UI at http://localhost:8025
# View queue info
python manage.py qinfo
# View scheduled tasks
python manage.py qmemory
# Run a specific task manually
python manage.py shell
>>> from django_q.tasks import async_task
>>> async_task('apps.billing.tasks.generate_monthly_invoices')After running seed_dev_data:
| Account | Use | |
|---|---|---|
| Perfect Payer | perfect_payer@test.com | Always pays on time |
| Chronic Late | chronic_charlie@test.com | Always pays late |
| Overdue Olivia | overdue_olivia@test.com | Has outstanding balance |
Login via OTP - emails appear in console.
Recommended extensions:
- Python (Microsoft)
- Pylance
- Django (Baptiste Darthenay)
- GitLens
Settings (.vscode/settings.json):
{
"python.defaultInterpreterPath": "./venv/bin/python",
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"editor.formatOnSave": true
}- Open project folder
- Configure interpreter:
venv/bin/python - Enable Django support: Settings → Languages & Frameworks → Django
- Set project root and settings module
Database connection refused
# Check PostgreSQL is running
sudo systemctl status postgresql
# Check connection
psql -U propmanager -d propmanagerRedis connection error
# Check Redis is running
redis-cli pingModule not found errors
# Ensure virtual environment is activated
source venv/bin/activate
# Reinstall dependencies
pip install -r requirements.txtMigration errors
# Check for conflicting migrations
python manage.py showmigrations
# Reset migrations (development only)
python manage.py migrate app_name zero
python manage.py migrate app_nameSee Troubleshooting Guide for more solutions.
- Read the Development Workflow guide
- Learn about Background Tasks
- Review the Architecture documentation
- Check out Contributing guidelines