-
Is it possible to set the server into debug mode so that I can attach my IDE (VS Code) to a running container and step through code at development time? I know that if I was doing this outside of a container, I could start the server explicitly, and provide the
I couldn't figure out how to do this using this image. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
VSCode (at least mine) has a FastAPI configuration built-in for running with breakpoints. If you go to the debug tab and select a configuration, FastAPI should be an option. You can also choose the option to create a I know this isn't really anything to do with the docker container... but that's what I do when I need to stop through. |
Beta Was this translation helpful? Give feedback.
-
@jonpeters did you figure it out? |
Beta Was this translation helpful? Give feedback.
-
Now that Uvicorn supports managing workers with Because of that, I deprecated this Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#-warning-you-probably-dont-need-this-docker-image That should make it easier to configure with just Uvicorn (without Gunicorn). On the other hand, for development, I would recommend you just start Uvicorn locally from the VS Code debugger, not through Docker, that would most probably make things simpler. 🤓 |
Beta Was this translation helpful? Give feedback.
Now that Uvicorn supports managing workers with
--workers
, including restarting dead ones, there's no need for Gunicorn. That also means that it's much simpler to build a Docker image from scratch now, I updated the docs to explain it.Because of that, I deprecated this Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#-warning-you-probably-dont-need-this-docker-image
That should make it easier to configure with just Uvicorn (without Gunicorn). On the other hand, for development, I would recommend you just start Uvicorn locally from the VS Code debugger, not through Docker, that would most probably make things simpler. 🤓