Django REST in Docker

88 views
Skip to first unread message

Shubham Joshi

unread,
Apr 9, 2019, 1:30:12 AM4/9/19
to Django users
I had set up django in Docker, now I am trying to install pip packages , like rest_framework and added in installed apps too.
but it throws ModuleNotFoundError: No module named 'rest_framework' , whats the generic way of installing the pip packages in existing dockerized django project

PASCUAL Eric

unread,
Apr 9, 2019, 4:00:56 AM4/9/19
to django...@googlegroups.com
Hi,

Working in contenerized context does not change anything from other modes. 

You just need to include the appropriate pip install command in the Dockerfile, so that all the dependencies are installed in the image. They will then available to your app the same way they are on you dev machine.

Could you show the content of your Dockerfile to check if there would not be some other problem ?

Eric


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Shubham Joshi <shu...@tersesoft.com>
Sent: Tuesday, April 9, 2019 07:30
To: Django users
Subject: Django REST in Docker
 
I had set up django in Docker, now I am trying to install pip packages , like rest_framework and added in installed apps too.
but it throws ModuleNotFoundError: No module named 'rest_framework' , whats the generic way of installing the pip packages in existing dockerized django project

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/656cff9e-50f9-4d5a-bafc-05eaa99778d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shubham Joshi

unread,
Apr 9, 2019, 4:55:22 AM4/9/19
to django...@googlegroups.com
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/


For more options, visit https://groups.google.com/d/optout.


--
Shubham Joshi
Business Developer | Terse Software
M: 8390246938

E: shubham@tersesoft.com
www.tersesoft.com
linkedingithub

Alessandro Madruga Correia

unread,
Apr 9, 2019, 9:31:10 AM4/9/19
to django...@googlegroups.com
You can use https://github.com/pydanny/cookiecutter-django as a start point.


For more options, visit https://groups.google.com/d/optout.


--
  ,= ,-_-. =.   [<o>] Alessandro Madruga Correia
 ((_/)o o(\_))  [http://counter.li.org]       Debian User# 342751 
   `-'(. .)`-'    "O fanatismo é a única forma de força de vontade 
       \_/        acessível aos fracos." (Friedrich Nietzsche)

PASCUAL Eric

unread,
Apr 9, 2019, 10:22:17 AM4/9/19
to django...@googlegroups.com
It seems right. 

I suppose that requirements.txt contains the rest_framework package too.

You can check the image content by executing the "pip freeze" command on it (docker run <image_name> pip freeze). This will tell you of all the packages you nee are there.

Eric


Sent: Tuesday, April 9, 2019 10:54
To: django...@googlegroups.com
Subject: Re: Django REST in Docker
 

Shubham Joshi

unread,
Apr 10, 2019, 7:50:21 AM4/10/19
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages