浏览代码

Merge pull request #382 from orchardup/use-official-repositories-in-django-example

Use official images in Django example
Aanand Prasad 11 年之前
父节点
当前提交
255b9419dd
共有 1 个文件被更改,包括 8 次插入9 次删除
  1. 8 9
      docs/django.md

+ 8 - 9
docs/django.md

@@ -10,9 +10,8 @@ Let's use Fig to set up and run a Django/PostgreSQL app. Before starting, you'll
 
 
 Let's set up the three files that'll get us started. First, our app is going to be running inside a Docker container which contains all of its dependencies. We can define what goes inside that Docker container using a file called `Dockerfile`. It'll contain this to start with:
 Let's set up the three files that'll get us started. First, our app is going to be running inside a Docker container which contains all of its dependencies. We can define what goes inside that Docker container using a file called `Dockerfile`. It'll contain this to start with:
 
 
-    FROM orchardup/python:2.7
+    FROM python:2.7
     ENV PYTHONUNBUFFERED 1
     ENV PYTHONUNBUFFERED 1
-    RUN apt-get update -qq && apt-get install -y python-psycopg2
     RUN mkdir /code
     RUN mkdir /code
     WORKDIR /code
     WORKDIR /code
     ADD requirements.txt /code/
     ADD requirements.txt /code/
@@ -24,11 +23,12 @@ That'll install our application inside an image with Python installed alongside
 Second, we define our Python dependencies in a file called `requirements.txt`:
 Second, we define our Python dependencies in a file called `requirements.txt`:
 
 
     Django
     Django
+    psycopg2
 
 
 Simple enough. Finally, this is all tied together with a file called `fig.yml`. It describes the services that our app comprises of (a web server and database), what Docker images they use, how they link together, what volumes will be mounted inside the containers and what ports they expose.
 Simple enough. Finally, this is all tied together with a file called `fig.yml`. It describes the services that our app comprises of (a web server and database), what Docker images they use, how they link together, what volumes will be mounted inside the containers and what ports they expose.
 
 
     db:
     db:
-      image: orchardup/postgresql
+      image: postgres
     web:
     web:
       build: .
       build: .
       command: python manage.py runserver 0.0.0.0:8000
       command: python manage.py runserver 0.0.0.0:8000
@@ -57,15 +57,14 @@ First thing we need to do is set up the database connection. Replace the `DATABA
     DATABASES = {
     DATABASES = {
         'default': {
         'default': {
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
-            'NAME': 'docker',
-            'USER': 'docker',
-            'PASSWORD': 'docker',
-            'HOST': os.environ.get('DB_1_PORT_5432_TCP_ADDR'),
-            'PORT': os.environ.get('DB_1_PORT_5432_TCP_PORT'),
+            'NAME': 'postgres',
+            'USER': 'postgres',
+            'HOST': 'db_1',
+            'PORT': 5432,
         }
         }
     }
     }
 
 
-These settings are determined by the [orchardup/postgresql](https://github.com/orchardup/docker-postgresql) Docker image we are using.
+These settings are determined by the [postgres](https://registry.hub.docker.com/_/postgres/) Docker image we are using.
 
 
 Then, run `fig up`:
 Then, run `fig up`: