#!/usr/bin/env python
"""
Script to collect static files for production deployment
"""
import os
import sys
import django
from pathlib import Path

# Add the project directory to Python path
BASE_DIR = Path(__file__).resolve().parent
sys.path.append(str(BASE_DIR))

# Set Django settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ruralpoint_system.settings_production')

# Setup Django
django.setup()

from django.core.management import execute_from_command_line

def collect_static():
    """Collect static files for production"""
    print("Collecting static files for production...")
    
    # Run collectstatic command
    execute_from_command_line(['manage.py', 'collectstatic', '--noinput', '--clear'])
    
    print("Static files collected successfully!")
    print(f"Static files are now in: {BASE_DIR / 'staticfiles'}")

if __name__ == '__main__':
    collect_static()
