GlowSenseAI / test_startup.py
Tayyaba11's picture
deploy backend
6e08e39
Raw
History Blame Contribute Delete
1.98 kB
"""Quick test to see what's blocking backend startup"""
import time
import sys
print("Testing backend startup components...\n")
# Test 1: Basic imports
start = time.time()
try:
print("1. Testing basic imports...")
from fastapi import FastAPI
from sqlalchemy import create_engine
print(f" βœ… Basic imports: {time.time() - start:.2f}s")
except Exception as e:
print(f" ❌ Import failed: {e}")
sys.exit(1)
# Test 2: Database connection
start = time.time()
try:
print("2. Testing database connection...")
from dotenv import load_dotenv
import os
load_dotenv()
from database import engine
from sqlalchemy import text
with engine.connect() as conn:
conn.execute(text("SELECT 1"))
print(f" βœ… Database connection: {time.time() - start:.2f}s")
except Exception as e:
print(f" ❌ Database connection failed: {e}")
print(f" Time taken: {time.time() - start:.2f}s")
# Test 3: Models import
start = time.time()
try:
print("3. Testing models import...")
import models
print(f" βœ… Models import: {time.time() - start:.2f}s")
except Exception as e:
print(f" ❌ Models import failed: {e}")
print(f" Time taken: {time.time() - start:.2f}s")
# Test 4: Stripe import
start = time.time()
try:
print("4. Testing Stripe import...")
import stripe
print(f" βœ… Stripe import: {time.time() - start:.2f}s")
except Exception as e:
print(f" ⚠️ Stripe import failed (optional): {e}")
print(f" Time taken: {time.time() - start:.2f}s")
# Test 5: APScheduler import
start = time.time()
try:
print("5. Testing APScheduler import...")
from apscheduler.schedulers.asyncio import AsyncIOScheduler
print(f" βœ… APScheduler import: {time.time() - start:.2f}s")
except Exception as e:
print(f" ⚠️ APScheduler import failed (optional): {e}")
print(f" Time taken: {time.time() - start:.2f}s")
print("\nβœ… Startup test complete!")