Like this, I can run my fastapi code! But I can't run it in debug mode for Pycharm IDE !

So, How use pycharm debugger mode to develop my fastapi server?
The easiest way is to make calls to your ASGI app using the starlette TestClient. You can see examples in the fastapi tests.
The easiest way is to just add a __main__ section to your app and run uvicorn by hand. Described here - https://fastapi.tiangolo.com/tutorial/debugging/
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
Like this, I can run my fastapi code! But I can't run it in debug mode for Pycharm IDE !
So, How use pycharm debugger mode to develop my fastapi server?
Hi @HalfLeaf, I also encounter this problem. Have you solved it ?
Like this, I can run my fastapi code! But I can't run it in debug mode for Pycharm IDE !
So, How use pycharm debugger mode to develop my fastapi server?Hi @HalfLeaf, I also encounter this problem. Have you solved it ?
I have sovled this problem. See: https://fastapi.tiangolo.com/tutorial/debugging/
uvicorn.run(app,host = “ 0.0.0.0 ”,port = 8000)
yes, you are right,great, thank you!
Thanks for the help here everyone!
Thanks @HalfLeaf for reporting back and closing the issue :+1:
Most helpful comment
The easiest way is to just add a
__main__section to your app and run uvicorn by hand. Described here - https://fastapi.tiangolo.com/tutorial/debugging/