ycd / manage-fastapi

:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.
https://github.com/ycd/manage-fastapi
MIT License
1.65k stars 106 forks source link

fastapi.run should be able to take arguments from cli #128

Open danilovmy opened 1 year ago

danilovmy commented 1 year ago

right now i should add some parameters directly in code:

@app.command(help="Run a FastAPI application.")
def run(prod: bool = typer.Option(False)):
    ....
    if not prod:
        # args.append("--reload")
        args.append("--log-level debug")
        args.append("--host 0.0.0.0")
        args.append("--port 8000")
        args.append("--access-log") 
    ....

But it is really standard and user-friendly to do, for example:

fastapi run --host 0.0.0.0 --port 7070