Files
mtgonline/backend/run.py
T
akadmin 0e6506d97f Update state.json and development plan to reflect actual progress (~15%)
- state.json: Phase 5 status changed to pending, next steps updated
- DEVELOPMENT_PLAN.md v1.1: Added actual progress, verified current state,
  renumbered phases 5-9, marked all remaining work as PENDING
- Deleted outdated plans (BACKEND_TEST_PLAN, DATA_LOADING_VERIFICATION,
  DOCKER_MIGRATION_PLAN, ENDPOINT_AUDIT, ROADMAP, SIMPLIFICATION_PLAN,
  STATEMENT_OF_INTENT, backend/TEST_PLAN)
- Added new files: DEVELOPMENT_PLAN.md, backend/ARCHITECTURAL_REPORT.md,
  backend/SIMPLIFICATION_SUMMARY.md, backend/run.py, backend/.dockerignore
2026-08-27 04:41:30 +00:00

51 lines
1.1 KiB
Python

#!/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()