This commit is contained in:
gaoshuaixing
2024-02-06 17:55:39 +08:00
parent 7c39580237
commit cfd7e2f5ef
5 changed files with 29 additions and 1 deletions

View File

@@ -1,8 +1,14 @@
import argparse
import uvicorn
from fastapi import FastAPI
app = FastAPI()
# argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--port', type=int, default=7074, help='The port number.')
args = parser.parse_args()
@app.get("/")
async def index():
"""
@@ -24,4 +30,4 @@ async def info():
}
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8000)
uvicorn.run(app, host="127.0.0.1", port=args.port)