forked from andika/membership-be
Deploy prep
This commit is contained in:
28
main.py
Normal file
28
main.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Main entry point for the FastAPI application.
|
||||
Starts uvicorn server with PORT from .env file.
|
||||
"""
|
||||
|
||||
import os
|
||||
import uvicorn
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
|
||||
# Load environment variables
|
||||
ROOT_DIR = Path(__file__).parent
|
||||
load_dotenv(ROOT_DIR / '.env')
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Get port from environment variable, default to 8000
|
||||
port = int(os.getenv("PORT", 8000))
|
||||
host = os.getenv("HOST", "0.0.0.0")
|
||||
|
||||
print(f"🚀 Starting server on {host}:{port}")
|
||||
|
||||
uvicorn.run(
|
||||
"server:app",
|
||||
host=host,
|
||||
port=port,
|
||||
reload=True, # Enable auto-reload during development
|
||||
log_level="info"
|
||||
)
|
||||
Reference in New Issue
Block a user