# 🚀 cPanel Deployment Guide

## Step-by-Step Instructions for Deploying MEGA GROK MARKETING LABS Dashboard on cPanel

### 📋 Prerequisites
- cPanel hosting account with Python support
- Domain name configured
- FTP/SFTP access or cPanel File Manager

### 🔧 Step 1: Prepare Files
1. Download the `dashboard_package` folder
2. Ensure all files are included:
   - `app.py` (main application)
   - `requirements.txt` (dependencies)
   - `templates/` folder with all HTML files
   - `wsgi.py` (WSGI configuration)
   - `.htaccess` (Apache configuration)
   - Sample data files

### 📁 Step 2: Upload to cPanel
1. **Login to cPanel**
2. **Open File Manager**
3. **Navigate to `public_html`** (or your domain's root directory)
4. **Upload the dashboard files**:
   - Upload all files from `dashboard_package/` to `public_html/`
   - Maintain the folder structure

### 🐍 Step 3: Configure Python App
1. **Go to "Python App" in cPanel**
2. **Create a new Python application**:
   - App Name: `mega-grok-dashboard`
   - App Root: `public_html`
   - App URL: `/` (or your desired subdirectory)
   - App Startup File: `wsgi.py`
3. **Set Python Version**: Choose Python 3.8 or higher
4. **Install Dependencies**:
   ```bash
   pip install -r requirements.txt
   ```

### ⚙️ Step 4: Configure Web Server
1. **Ensure `.htaccess` is uploaded** (for Apache)
2. **Set proper file permissions**:
   - `app.py`: 755
   - `wsgi.py`: 755
   - `templates/`: 755
   - Other files: 644

### 🔒 Step 5: Security Configuration
1. **Change the secret key** in `app.py`:
   ```python
   app.secret_key = 'your-unique-secret-key-here'
   ```
2. **Enable HTTPS** in cPanel
3. **Configure SSL certificate**

### 🌐 Step 6: Domain Configuration
1. **Point your domain** to the cPanel hosting
2. **Configure DNS** if needed
3. **Test access** via your domain

### 🧪 Step 7: Testing
1. **Visit your domain** in a web browser
2. **Test all dashboard features**:
   - Main dashboard loads
   - Configuration page works
   - File management functions
   - Logs display correctly
3. **Check demo mode** is working

### 🔧 Step 8: Customization
1. **Update configuration** in the dashboard
2. **Modify email templates** as needed
3. **Add your actual email lists**
4. **Configure SMTP settings**

### 🚨 Troubleshooting

#### Common Issues:
- **500 Internal Server Error**: Check file permissions and Python app configuration
- **Module not found**: Ensure all dependencies are installed
- **Template not found**: Verify `templates/` folder is uploaded correctly
- **WSGI errors**: Check `wsgi.py` configuration

#### Debug Steps:
1. Check cPanel error logs
2. Verify Python app is running
3. Test with simple Python script first
4. Check file permissions

### 📞 Support
- Check cPanel documentation for Python apps
- Contact your hosting provider for Python support
- Review Flask deployment guides

### ⚠️ Important Notes
- This is a **DEMO VERSION** - modify for production use
- Change default passwords and secret keys
- Implement proper authentication
- Ensure compliance with hosting terms of service
- Use HTTPS in production

---

**Deployment completed successfully!** 🎉

Your MEGA GROK MARKETING LABS Dashboard should now be accessible via your domain.
