JavaScript
x
11
11
1
FROM python:3.8
2
WORKDIR /app
3
4
COPY requirements.txt /
5
RUN pip install --requirement /requirements.txt
6
7
COPY ./app /app
8
9
EXPOSE 8000
10
CMD ["uvicorn", "app.main:app", "--host=0.0.0.0" , "--reload" , "--port", "8000"]
11
when i used
docker-compose up -d
ModuleNotFoundError: No module named ‘app’
the folders in Fastapi framework:
fastapi
app
-main.py
-
JavaScript121
language_detector.py
2
Dockerfile
docker-compose
Advertisement
Answer
JavaScript
1
2
1
CMD ["uvicorn", "main:app", "--host=0.0.0.0" , "--reload" , "--port", "8000"]
2
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.