import sys
import os

print("--- SYSTEM DIAGNOSTICS ---")
print(f"Python Version: {sys.version}")
print(f"Current Directory: {os.getcwd()}")

try:
    import flask
    print("✅ Flask is installed")
except ImportError:
    print("❌ Flask is MISSING")

try:
    from flask_cors import CORS
    print("✅ Flask-CORS is installed")
except ImportError:
    print("❌ Flask-CORS is MISSING")

try:
    import dotenv
    print("✅ python-dotenv is installed")
except ImportError:
    print("❌ python-dotenv is MISSING")

try:
    import docx
    print("✅ python-docx is installed")
except ImportError:
    print("❌ python-docx is MISSING")

db_path = os.path.join(os.getcwd(), 'memorial.db')
if os.path.exists(db_path):
    print(f"✅ Database found at {db_path}")
    print(f"Permissions: {oct(os.stat(db_path).st_mode)[-3:]}")
else:
    print("❌ Database file NOT FOUND")