-
env
venv
-
code
import argparse parser = argparse.ArgumentParser() parser.add_argument("--host", type=str, default="0.0.0.0", help='default Ip') parser.add_argument("--port", type=int, default=18002, help='default port')
import uvicorn from fastapi import FastAPI if __name__ == '__main__': import uvicorn app = create_app() uvicorn.run(app, host=str(args.host), port=int(args.port))
-
bootstrap
python -m uvicorn main:app --reload
-
error
error: unrecognized arguments: main:app --reload
i try use uvicorn.run(app, host="0.0.0.0", port=18002)
but problem still raise, has anyone else had similar problems and can offer some help?