How to install python libraries in dockerized django project

My django project is docerized.I am trying to install new libraries by adding those in requirements.txt and running the “docker-compose up --build”.But it isn’t working.help me.

Welcome @Juhair_Manar !

Side note: Please don’t post screenshots of code or text. Copy/paste the text into the body of your post, marked as “preformatted text” where appropriate.

What does your dockerfile look like for your container? Are you doing a pip install -r requirements.txt?

Make sure the Dockerfile is set up to install dependencies from requirements.txt.
It should look something like this:
FROM python:3.x

Set the working directory
WORKDIR /app

Copy the requirements.txt file into the container
COPY requirements.txt .

Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
Copy the rest of the application
COPY . .

Run the app
CMD [“python”, “manage.py”, “runserver”]

1 Like

@Isla011 , Please do not recommend to people that the use runserver in their docker deployments. It’s not a production-quality server and should not be used as such. It has no business being used in that manner. (See the docs for runserver.)