Docker Community Forums

Share and learn in the Docker community.

How to install the django rest framework on docker

I have installed the following 3rd party libraries using the requirements.txt.
The content of the file is:

FROM python:3.7-slim

# Set environment varibles

ENV PYTHONDONTWRITEBYTECODE 1

ENV PYTHONUNBUFFERED 1

# Set work directory

WORKDIR /airproject

# Install dependencies

COPY requirements.txt /airproject/requirements

RUN pip install -r /airproject/requirements

# Copy project

COPY . /airproject/

And the requirements.txt is:

certifi==2019.3.9

chardet==3.0.4

Django==2.2.1

djangorestframework==3.9.2

idna==2.8

pytz==2019.1

requests==2.22.0

six==1.12.0

sqlparse==0.3.0

urllib3==1.25.2

I built the docker image without problems.

But whhen I run ‘docker-compose up’, it comes back with message, ModuleNotFoundError: No module named ‘rest_framework’. What should I do fix the problem?