Skip to content

Commit 3fc41d4

Browse files
committed
fix(common): cf apps should listen to port from the env
1 parent bb42252 commit 3fc41d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

example/my-app/src/my_app/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from fastapi import FastAPI
24
import uvicorn
35

@@ -9,4 +11,5 @@ def hello_world():
911
return {"message": "Hello, World!"}
1012

1113
def start() -> None:
12-
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

Comments
 (0)