from django.conf import settings
from django.templatetags.static import static
from django.utils.translation import get_language
import os

def get_logo():
    # Get the logo path from the settings
    local_path = os.path.join(settings.WEBSITE_MEDIA_ROOT, '__common__', 'logo.png')
    static_path = os.path.join("website", 'img', '__common__', 'logo.png')
    
    print(f"\n\n{local_path}\n\n")
    
    if os.path.exists(local_path):
        return static(static_path)
    
    else:
        static_path = os.path.join("website", 'img', '__common__', 'defaults/default_logo.png')
        return static(static_path)
    
def general(request):
    return {
        "general": {
            "logo_path": get_logo(),
            "favicon_path": static(os.path.join("website", 'img', '__common__', 'favicon.png')),
        }
    }