79332693

Date: 2025-01-06 10:08:29
Score: 1.5
Natty:
Report link

Wanted to comment on AKX answer, but I can't. rep too low. This is how i did mine.

docs_url=None if APP_MODE == "production" else "/docs" #disables docs
redoc_url=None if APP_MODE == "production" else "/redoc" #disables redoc
openapi_url=None if APP_MODE == "production" else "/openapi.json" #disables openapi.json suggested by tobias comment.
app = FastAPI(docs_url=docs_url, redoc_url=redoc_url, openapi_url=openapi_url)

where APP_MODE is os.environ.get("APP_MODE", "production")

Reasons:
  • Blacklisted phrase (1): to comment
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: daviddanielng