use production mode switch for reloading

This commit is contained in:
Jörn-Michael Miehe 2022-09-05 12:56:57 +00:00
parent 7a0925d60f
commit 09b7d59b39
2 changed files with 6 additions and 3 deletions

View file

@ -9,7 +9,10 @@
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"module": "ovdashboard_api.main", "module": "ovdashboard_api.main",
"justMyCode": true "justMyCode": true,
"env": {
"PRODUCTION_MODE": "false"
}
} }
] ]
} }

View file

@ -9,8 +9,8 @@ Creates the main `FastAPI` app.
import uvicorn import uvicorn
from fastapi import FastAPI from fastapi import FastAPI
from .settings import SETTINGS
from .routers import main_router from .routers import main_router
from .settings import SETTINGS
app = FastAPI( app = FastAPI(
title="OVDashboard API", title="OVDashboard API",
@ -36,7 +36,7 @@ def main() -> None:
app="ovdashboard_api.main:app", app="ovdashboard_api.main:app",
host="0.0.0.0", host="0.0.0.0",
port=8000, port=8000,
reload=True, reload=not SETTINGS.production_mode,
) )