更改HUG的端口

bra*_*ted 2 python web-services python-3.x hug

是否可以更改HUG for python的端口号?我有以下示例要尝试做。该API默认为端口8000,但我希望能够手动设置。

@hug.post()
def receive_json(request):
    request=str(request)
    print("Hello! Glad you're here!")
    print(request)
    process=os.system("echo "+'"'+request+'"')
Run Code Online (Sandbox Code Playgroud)

mis*_*sak 5

app.py文件(或文件名)的末尾添加:

hug.API(__name__).http.serve(port=8005)
Run Code Online (Sandbox Code Playgroud)

用于在端口8005上服务