Published -  5 years ago ( Updated -  5 years ago )
                
            
1. Installation
On the host side, I will put it into the background execution, and use the following command in the bash environment:
pip install fastapi uvicorn
2. Sample programs (of course, if possible, create a verticalenv to run.
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
    return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}
nohup uvicorn main:app --reload --host 0.0.0.0 &
If you want to stop I use the following command
killall uvicorn
 To view execution status, use the
tail -f nohup.out
 
            
         
                                 
                                     
                                     
                                    
No Comment
Post your comment