We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb42252 commit 3fc41d4Copy full SHA for 3fc41d4
example/my-app/src/my_app/main.py
@@ -1,3 +1,5 @@
1
+import os
2
+
3
from fastapi import FastAPI
4
import uvicorn
5
@@ -9,4 +11,5 @@ def hello_world():
9
11
return {"message": "Hello, World!"}
10
12
13
def start() -> None:
- uvicorn.run("my_app.main:app", host="0.0.0.0", port=8000, reload=True)
14
+ port = int(os.environ.get("PORT", "8000"))
15
+ uvicorn.run("my_app.main:app", host="0.0.0.0", port=port, reload=False)
0 commit comments