mirror of https://github.com/docker/docs.git
Merge pull request #6725 from 2tunnels/patch-1
update compose django example
This commit is contained in:
commit
565537843b
|
@ -30,9 +30,9 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi
|
|||
ENV PYTHONUNBUFFERED 1
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
ADD requirements.txt /code/
|
||||
COPY requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
ADD . /code/
|
||||
COPY . /code/
|
||||
|
||||
This `Dockerfile` starts with a [Python 3 parent image](https://hub.docker.com/r/library/python/tags/3/).
|
||||
The parent image is modified by adding a new `code` directory. The parent image is further modified
|
||||
|
@ -46,8 +46,8 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi
|
|||
|
||||
6. Add the required software in the file.
|
||||
|
||||
Django>=1.8,<2.0
|
||||
psycopg2
|
||||
Django>=2.0,<3.0
|
||||
psycopg2>=2.7,<3.0
|
||||
|
||||
7. Save and close the `requirements.txt` file.
|
||||
|
||||
|
@ -71,7 +71,7 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi
|
|||
image: postgres
|
||||
web:
|
||||
build: .
|
||||
command: python3 manage.py runserver 0.0.0.0:8000
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
volumes:
|
||||
- .:/code
|
||||
ports:
|
||||
|
@ -93,15 +93,15 @@ In this step, you create a Django starter project by building the image from the
|
|||
2. Create the Django project by running
|
||||
the [docker-compose run](/compose/reference/run/) command as follows.
|
||||
|
||||
sudo docker-compose run web django-admin.py startproject composeexample .
|
||||
sudo docker-compose run web django-admin startproject composeexample .
|
||||
|
||||
This instructs Compose to run `django-admin.py startproject composeexample`
|
||||
This instructs Compose to run `django-admin startproject composeexample`
|
||||
in a container, using the `web` service's image and configuration. Because
|
||||
the `web` image doesn't exist yet, Compose builds it from the current
|
||||
directory, as specified by the `build: .` line in `docker-compose.yml`.
|
||||
|
||||
Once the `web` service image is built, Compose runs it and executes the
|
||||
`django-admin.py startproject` command in the container. This command
|
||||
`django-admin startproject` command in the container. This command
|
||||
instructs Django to create a set of files and directories representing a
|
||||
Django project.
|
||||
|
||||
|
@ -202,7 +202,7 @@ In this section, you set up the database connection for Django.
|
|||
|
||||
5. List running containers.
|
||||
|
||||
In another terminal window, list the running Docker processes with the `docker ps` command.
|
||||
In another terminal window, list the running Docker processes with the `docker container ls` command.
|
||||
|
||||
```none
|
||||
$ docker ps
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue