Skip to content Skip to sidebar Skip to footer

Django: Module Not Found While Running In Docker Container

I'm running a Django project in a Docker container, and I want to add a module (specifically, django-prometheus) I ran: pip install django-prometheus and docker run -p 9090:9090 pr

Solution 1:

In your Dockerfile, you should make sure you have a pip install command. Please have a look at the following example. The prometheus module should be listed in the requirements.txt file.

RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common \
&& apt-get update \
&& apt-get install -q -y --no-install-recommends python3 python3-dev python3-pip python3-setuptools python3-wheel gcc \
&& apt-get install -q -y vim \
&& apt-get clean 

ADD requirements.txt /app/requirements.txt
RUN pip3 install -r /app/requirements.txt

# Add the application source code.
ADD . /app

Post a Comment for "Django: Module Not Found While Running In Docker Container"