Configuration

After installation, configure the system according to your organization's needs.

Environment Configuration

Django Settings

Edit .env file:

# Security
SECRET_KEY=generate-a-long-random-secret-key
DEBUG=False  # Set to False in production

# Allowed Hosts
ALLOWED_HOSTS=your-domain.com,172.16.1.172

# Database (if using PostgreSQL)
DATABASE_URL=postgresql://user:password@localhost:5432/dbname

Generate Secret Key

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

SAP HANA Configuration

Test Connection

python manage.py configure_email

Or test manually:

from hdbcli import dbapi
conn = dbapi.connect(
    address='172.16.25.3',
    port=30015,
    user='your_user',
    password='your_password'
)
print("✓ Connected successfully")
conn.close()

Configure Schema

The default schema is SGI_LIVE_HANA. To change:

python manage.py init_settings
# Then update via admin panel or:
python manage.py shell
>>> from quotation.extractor.models import SystemSetting
>>> SystemSetting.objects.update_or_create(
...     key='HANA_SCHEMA',
...     defaults={'value': 'YOUR_SCHEMA_NAME'}
... )

Microsoft Teams Integration

Get Webhook URL

  1. Open Microsoft Teams
  2. Go to your channel → ⋯ → Connectors
  3. Search for "Incoming Webhook"
  4. Configure and copy the URL

Configure Webhook

python manage.py configure_teams

Or manually add to .env:

TEAMS_WEBHOOK_URL=https://outlook.office.com/webhook/your-webhook-url

Test Notification

python manage.py shell
>>> from quotation.utils.teams_webhook import send_teams_notification
>>> send_teams_notification("Test", "Testing webhook", "good")

Email Configuration (Optional)

For email notifications, add to quotation/settings.py:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@domain.com'
EMAIL_HOST_PASSWORD = 'your-app-password'
DEFAULT_FROM_EMAIL = 'noreply@domain.com'

System Settings

Access system settings via:

  1. Admin Panel: http://172.16.1.172:8000/admin/

    • Login with superuser account
    • Navigate to "System Settings"
  2. Settings Page: http://172.16.1.172:8000/settings/

    • Login with processor account
    • Configure SAP, Teams, and Email settings

Available Settings

Setting Description Default
HANA_HOST SAP HANA server IP 172.16.25.3
HANA_PORT SAP HANA port 30015
HANA_SCHEMA Database schema SGI_LIVE_HANA
TEAMS_WEBHOOK_URL Teams webhook URL None
ENABLE_NOTIFICATIONS Enable/disable Teams notifications True

File Upload Settings

In quotation/settings.py:

# Maximum file size (10MB)
DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760

# Allowed file types
ALLOWED_EXTENSIONS = ['.xlsx', '.xls']

# Upload directory
MEDIA_ROOT = BASE_DIR / 'uploads'

Logging Configuration

Logs are stored in logs/ directory:

  • logs/django.log - General application logs
  • logs/extraction.log - File processing logs
  • logs/server.log - Server output (when running in background)

View Logs

# View all logs
./view_logs.sh all

# View Django logs
./view_logs.sh django

# View extraction logs
./view_logs.sh extraction

Log Level

Edit quotation/settings.py to change log level:

LOGGING = {
    'loggers': {
        'django': {
            'level': 'INFO',  # Change to 'DEBUG' for more detail
        },
        'quotation.extractor': {
            'level': 'INFO',
        },
    },
}

User Management

Create Additional Users

python manage.py createsuperuser

Or use Django admin panel at /admin/.

User Groups

  • Uploaders: Can only upload files
  • Processors: Full access to dashboard and processing

Assign users to groups in admin panel.

Performance Tuning

Database Optimization

For PostgreSQL:

-- Create indexes
CREATE INDEX idx_quotation_qti ON quotation_quotationdata(qti);
CREATE INDEX idx_session_status ON quotation_uploadsession(status);

Caching (Optional)

Add Redis caching:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.redis.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/1',
    }
}

Security Recommendations

  1. Change default passwords for demo accounts
  2. Use HTTPS in production with SSL certificate
  3. Set DEBUG=False in production
  4. Use strong SECRET_KEY
  5. Restrict ALLOWED_HOSTS to your domain only
  6. Regular backups of database and uploaded files

Backup Configuration

Create backup script:

#!/bin/bash
# backup.sh
DATE=$(date +%Y%m%d_%H%M%S)
python manage.py dumpdata > backup_$DATE.json
tar -czf backup_$DATE.tar.gz db.sqlite3 uploads/ backup_$DATE.json

Next Steps

First Upload

results matching ""

    No results matching ""