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 28f6a53 commit 50540dcCopy full SHA for 50540dc
Procfile
@@ -1 +1 @@
1
-web: uvicorn src.main:app --host=0.0.0.0 --port=${PORT:-5000}
+web: uvicorn main:app --host=0.0.0.0 --port=${PORT:-5000}
main.py
@@ -1,3 +1,6 @@
+import socket
2
+import sys
3
+
4
from fastapi import FastAPI,Form
5
from fastapi.responses import HTMLResponse
6
from fastapi.templating import Jinja2Templates
@@ -6,6 +9,15 @@
9
7
10
app = FastAPI()
8
11
templates = Jinja2Templates(directory="templates/")
12
+hostname = socket.gethostname()
13
14
+@app.get("/")
15
+async def read_root():
16
+ return {
17
+ "name": "babybot",
18
+ "host": hostname,
19
+ "version": f"Hello world! From FastAPI running on Uvicorn. Using Python"
20
+ }
21
22
@app.get("/hello/", response_class=HTMLResponse)
23
async def hello():
0 commit comments