Add Django startup debugging to wsgi.py

- Add try/catch around get_wsgi_application() to capture startup errors
- Print detailed error messages and traceback for debugging
- Exit with error code 1 on failure to ensure container fails fast
- This will help diagnose the silent Django startup failure in Dokploy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
thecyberlearn 2025-09-05 08:32:32 +05:30
parent e7fef02176
commit 9ee78fc770

View File

@ -8,9 +8,18 @@ https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
"""
import os
import sys
import traceback
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'netcop_hub.settings')
try:
application = get_wsgi_application()
print("Django WSGI application loaded successfully!")
except Exception as e:
print(f"FATAL ERROR during Django startup: {e}")
print("Full traceback:")
traceback.print_exc()
sys.exit(1)