admin 管理员组

文章数量: 1086019

I have a very simple FastAPI server.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Hello, World!"}

@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
    return {"item_id": item_id, "q": q}

@app.post("/items/")
def create_item(item: dict):
    return {"message": "Item created", "item": item}

When I try to start the server using the following command, the terminal just gets stuck and nothing happens. Im unable to ctrl + c out of the terminal as well and all I can do is to kill the terminal process.

fastapi dev main.py --port 8001 

On the other hand, if I was to start the same server using

uvicorn main:app --reload --port 8001

The terminal responded immediately and my server spun up as per normal. Can I know if anybody knows the cause for this issue.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)