Spaces:
Runtime error
Runtime error
| """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!") | |