Skip to content
Advertisement

ModuleNotFoundError: No module named ‘app’ fastapi docker

JavaScript

when i used

docker-compose up -d
ModuleNotFoundError: No module named ‘app’

  • the folders in Fastapi framework:

  • fastapi

    • app

      -main.py

  • JavaScript
  • Dockerfile

  • docker-compose

Advertisement

Answer

JavaScript

Your work directory is /app and the main.py file is already there. So you don’t need to call app.main module. Just call main.py script directly in CMD.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement