Irfan Harun
Irfan Harun

Reputation: 1059

how to run exsisting django project in docker?

I'm trying to containerize my existing django project, which works just fine in my local machine.

dockerfile is as follows:

FROM django
ADD . /
WORKDIR /site
RUN pip install django-elasticsearch-dsl==0.5.1
RUN pip install tika==1.19
CMD python manage.py runserver 0.0.0.0:8000

i was able to create an image using :

docker build -t test1 .

and was able to create a container using the image by command :

docker run -d --name test1 -p 8000:8000 test1

as a result, i can see that the container test1 is up and running

Now, my understanding is if i do localhost:8000 in my browser, i should be able to see the view the required pages.

However, I don't see it.

I've have tried similar solutions available in stackoverflow, yet no success.

Upvotes: 1

Views: 649

Answers (1)

LinPy
LinPy

Reputation: 18578

This image is officially deprecated in favor of the standard python image, and will receive no further updates after 2016-12-31 (Dec 31, 2016). Please adjust your usage accordingly.

For most usages of this image, it was already not bringing in django from this image, but actually from your project's requirements.txt, so the only "value" being added here was the pre-installing of mysql-client, postgresql-client, and sqlite3 for various uses of the django framework.

For example, a Dockerfile similar to the following would be a good starting point for a Django project using PostgreSQL:

FROM python:3.4

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        postgresql-client \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

source

PS: your Dockerfile is complaining about manage.py is not found

Upvotes: 2

Related Questions