# Haven Grazuri Investment Limited - Quick Start Guide

## 🚀 Deploy in 2 Minutes

### Windows (Easiest)
```batch
deploy.bat
```

### Any Platform
```bash
python deploy.py
```

That's it! The script does everything automatically.

---

## What Happens Automatically

1. ✅ Checks Python & MySQL
2. ✅ Installs all requirements
3. ✅ Creates fresh database
4. ✅ Runs all migrations
5. ✅ Creates admin account
6. ✅ Loads initial data
7. ✅ Imports Grazuri users (if available)
8. ✅ Starts server at http://127.0.0.1:8000/

**Total Time:** ~2-3 minutes

---

## Login Credentials

**Admin Account:**
- Username: `admin`
- Password: `Admin@2025`
- URL: http://127.0.0.1:8000/

**Change password after first login!**

---

## System Requirements

- Python 3.8+
- MySQL 8.0+
- MySQL credentials:
  - User: `root`
  - Password: `password`

---

## Deployment Options

### Full Reset (Default)
```bash
python deploy.py
```
Drops database, creates fresh installation

### Keep Database
```bash
python deploy.py --skip-db
```
Only updates code and runs migrations

### No Server Start
```bash
python deploy.py --no-server
```
Deploys but doesn't start server

### Production Mode
```bash
python deploy.py --production --no-server
```
Production settings, no debug mode

---

## After Deployment

### 1. Access System
- Homepage: http://127.0.0.1:8000/
- Admin Panel: http://127.0.0.1:8000/admin/
- Login: admin / Admin@2025

### 2. Start Using
- Create clients
- Create loan applications
- Approve loans
- Process payments

### 3. Import Grazuri Data (Optional)
```bash
python import_grazuri_users.py
```

---

## Troubleshooting

### MySQL Connection Failed
1. Check MySQL is running
2. Verify credentials in `deploy.py`
3. Test: `mysql -u root -p`

### Port 8000 In Use
```bash
python manage.py runserver 8001
```

### Python Not Found
1. Install Python from python.org
2. Add to PATH
3. Restart terminal

---

## Manual Deployment (If Script Fails)

```bash
# 1. Install requirements
pip install -r requirements.txt

# 2. Create database
mysql -u root -p
CREATE DATABASE acbptxvs_branch_system;
exit

# 3. Run migrations
python manage.py migrate

# 4. Create superuser
python manage.py createsuperuser

# 5. Start server
python manage.py runserver
```

---

## Production Deployment

### 1. Update .env
```env
DEBUG=False
SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=yourdomain.com
```

### 2. Use Gunicorn
```bash
pip install gunicorn
gunicorn branch_system.wsgi:application --bind 0.0.0.0:8000
```

### 3. Set Up Nginx
```nginx
server {
    listen 80;
    server_name yourdomain.com;
    
    location / {
        proxy_pass http://127.0.0.1:8000;
    }
}
```

### 4. Enable SSL
```bash
sudo certbot --nginx -d yourdomain.com
```

---

## Key Features

### ✅ Tested & Working
- User authentication
- Client management
- Loan applications
- Loan approval
- Payment processing
- Interest calculations
- Reports & analytics

### ✅ Manual Data Entry
- Create clients (no errors)
- Create loans (automatic calculations)
- Approve loans (automatic processing)
- All data properly linked

### ✅ Data Import
- Import Grazuri users
- Import borrowers
- Import loans
- Import payments

---

## Documentation

- **DEPLOYMENT_GUIDE.md** - Complete deployment guide
- **README.md** - System overview
- **SYSTEM_READY_CONFIRMATION.md** - Test results
- **TEST_USERS_CREDENTIALS.md** - User accounts
- **IMPORTED_GRAZURI_USERS.md** - Imported users

---

## Support

**Haven Grazuri Investment Limited**
- Email: havenin2023@gmail.com
- Phone: +254112941830
- WhatsApp: +254112941830

---

## Quick Commands

```bash
# Deploy system
python deploy.py

# Start server
python manage.py runserver

# Import users
python import_grazuri_users.py

# Test system
python test_manual_data_entry.py

# Create backup
mysqldump -u root -p acbptxvs_branch_system > backup.sql

# Restore backup
mysql -u root -p acbptxvs_branch_system < backup.sql
```

---

## System Status

✅ **FULLY OPERATIONAL**  
✅ **ALL TESTS PASSED**  
✅ **READY FOR PRODUCTION**  
✅ **PERFECT FOR MANUAL DATA ENTRY**

🎉 **START USING IT NOW!**

---

**Last Updated:** May 8, 2026  
**Version:** 1.0  
**Status:** Production Ready
