-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (19 loc) · 760 Bytes
/
main.py
File metadata and controls
25 lines (19 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from backend.app.core.logging import logger, cleanup_old_logs
import os
from backend.app.api.routes import router
# Clean up logs on startup
logs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs')
os.makedirs(logs_dir, exist_ok=True)
app_log_path = os.path.join(logs_dir, 'app.log')
cleanup_old_logs(app_log_path)
app = FastAPI()
# Mount static files (your frontend)
app.mount("/static", StaticFiles(directory="static"), name="static")
# Include the router
app.include_router(router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)
# or in command line: uvicorn main:app --host 127.0.0.1 --port 8000 --reload