#!/usr/bin/env python3 """Simple startup script for MTG Online backend. Usage: cd backend python run.py This will: 1. Initialize the database (create tables if needed) 2. Start the FastAPI server with uvicorn 3. Listen on http://0.0.0.0:8000 For development: - Uses SQLite by default (configured in app/core/config.py) - No external dependencies required - Hot reload enabled with --reload flag For production: - Set DATABASE_URL to PostgreSQL connection string - Set SECRET_KEY to a secure random value - Run without --reload flag """ import sys import uvicorn from app.core.database import create_tables from app.main import app def main(): """Initialize database and start the server.""" print("Initializing database...") # Run create_tables in an event loop import asyncio asyncio.run(create_tables()) print("Database initialized.") print("Starting server at http://0.0.0.0:8000") print("API docs available at http://0.0.0.0:8000/docs") uvicorn.run( app, host="0.0.0.0", port=8000, reload=True, # Enable hot reload for development ) if __name__ == "__main__": main()