GithubHelp home page GithubHelp logo

kludex / fastapi-docker-debug Goto Github PK

View Code? Open in Web Editor NEW
45.0 2.0 5.0 28 KB

Need to debug your FastAPI application with Docker? Don't worry! :sunglasses:

License: MIT License

Dockerfile 26.58% Makefile 44.24% Python 29.18%

fastapi-docker-debug's Introduction

Warning Now that VSCode natevily supports FastAPI for debugging purposes, I'll archive this project.

Debug FastAPI Applications on Docker ๐Ÿ‹

This is a very simple demonstration on how to debug your FastAPI application via Docker container. ๐Ÿ˜Ž

We'll make use of the following tools:

So please, if you don't have them installed, feel free to do so.

Usage ๐Ÿ–ฅ๏ธ

Very simple app and usage. Let's not complicate things here! ๐Ÿ˜‡

Build and run your docker-compose with the following command:

docker-compose -f docker-compose.debug.yaml up

Ok, what's happening? Looks like the process is hanging, but don't worry!

Go to your VSCode and press F5.

At this point, our debugger is connected! You now can add breaking points and debug your applications! ๐Ÿ˜™

License ๐Ÿ“–

This project is licensed under the terms of the MIT license.

fastapi-docker-debug's People

Contributors

kludex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fastapi-docker-debug's Issues

wait-for-client never terminating

Greetings @Kludex thank you for this repo. I am trying to use this with my application, however it seems that when adding wait-for-client it never returns, hence the application never starts. Do you know what could be going on here?

Part of my docker-compose file:

command: >
      sh -c "
        pip install debugpy && 
        python wait_for_localstack_ready.py &&
        python -m debugpy --wait-for-client --listen 0.0.0.0:5678 -m uvicorn app.main:app --host 0.0.0.0 --port 80 --reload
      "

Without works without any problems.

command: >
      sh -c "
        python wait_for_localstack_ready.py &&
        uvicorn app.main:app --host 0.0.0.0 --port 80 --reload
      "

It works now, I had the wrong path in launch.json configured, d'oh!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.