{"action":"created","comment":{"url":"https://api.github.com/repos/docker/compose/pulls/comments/40387815","id":40387815,"diff_hunk":"@@ -12,18 +12,16 @@ weight=4\n \n ## Quickstart Guide: Compose and Django","path":"docs/django.md","position":2,"original_position":2,"commit_id":"6acae833a048aeebd87458c94492a77061fe7fd7","original_commit_id":"6acae833a048aeebd87458c94492a77061fe7fd7","user":{"login":"moxiegirl","id":1347209,"avatar_url":"https://avatars.githubusercontent.com/u/1347209?v=3","gravatar_id":"","url":"https://api.github.com/users/moxiegirl","html_url":"https://github.com/moxiegirl","followers_url":"https://api.github.com/users/moxiegirl/followers","following_url":"https://api.github.com/users/moxiegirl/following{/other_user}","gists_url":"https://api.github.com/users/moxiegirl/gists{/gist_id}","starred_url":"https://api.github.com/users/moxiegirl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxiegirl/subscriptions","organizations_url":"https://api.github.com/users/moxiegirl/orgs","repos_url":"https://api.github.com/users/moxiegirl/repos","events_url":"https://api.github.com/users/moxiegirl/events{/privacy}","received_events_url":"https://api.github.com/users/moxiegirl/received_events","type":"User","site_admin":false},"body":"@charleswhchan Thanks for the changes Charles, are you willing to go a bit further? These instructions are very hard to follow because they don't use steps which can help readers follow the flow better.  Would you be willing to add them ? There are other structural issues like it stars with a head ## instead of a # ....\r\n\r\nHaving you do this means we get an extra tech review on the steps.\r\n\r\n--> https://gist.github.com/moxiegirl/e4b95e07a7f811db40b5\r\n\r\n\r\n<!--[metadata]>\r\n+++\r\ntitle = \"Quickstart Guide: Compose and Django\"\r\ndescription = \"Getting started with Docker Compose and Django\"\r\nkeywords = [\"documentation, docs,  docker, compose, orchestration, containers\"]\r\n[menu.main]\r\nparent=\"smn_workw_compose\"\r\nweight=4\r\n+++\r\n<![end-metadata]-->\r\n\r\n\r\n# Quickstart Guide: Compose and Django\r\n\r\nThis quick-start guide demonstrates how to use Compose to set up and run a\r\nsimple Django/PostgreSQL app. Before starting, you'll need to have\r\n[Compose installed](install.md).\r\n\r\n## Define the project components\r\n\r\nFor this project, you need to create a Dockerfile, a Python dependencies file,\r\nand a `docker-compose.yml` file.\r\n\r\n1. Create an empty project directory.\r\n\r\n    You can name the directory something easy for your to remember. This directory is the context for your application image. The directory should only contain resources to build that image.\r\n\r\n2. Create a new file called `Dockerfile` in your project directory.\r\n\r\n    The Dockerfile defines an application's image content via one or more build\r\n    commands that configure that image. Once built, you can run the image in a\r\n    container.  For more information on `Dockerfiles`, see the [Docker user\r\n    guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile)\r\n    and the [Dockerfile reference](http://docs.docker.com/reference/builder/).\r\n\r\n3. Add the following content to the `Dockerfile`.\r\n\r\n        FROM python:2.7\r\n        ENV PYTHONUNBUFFERED 1\r\n        RUN mkdir /code\r\n        WORKDIR /code\r\n        ADD requirements.txt /code/\r\n        RUN pip install -r requirements.txt\r\n        ADD . /code/\r\n\r\n    This `Dockerfile` starts with a Python 2.7 image. The base Python image is\r\n    modified by adding a new `code` directory. Into the directory, is installs\r\n    the Python requirements defined in the `requirements.txt` file.   \r\n\r\n4. Save and close the `Dockerfile`.\r\n\r\n5. Create a `requirements.txt` in your project directory.\r\n\r\n    This file is used by the `RUN pip install -r requirements.txt` command in your `Dockerfile`.\r\n\r\n6. List the required software in the file.\r\n\r\n        Django\r\n        psycopg2\r\n\r\n7. Save and close the `requirements.txt` file.\r\n\r\n8. Create a file called `docker-compose.yml` in your project directory.\r\n\r\n    The `docker-compose.yml` file describes the services that make your app. In\r\n    this example those services are a web server and database.  The compose file\r\n    also describes which Docker images these services use, how they link\r\n    together, any volumes they might need mounted inside the containers.\r\n    Finally, the `docker-compose.yml` file describes which ports these services\r\n    expose. See the [`docker-compose.yml` reference](yml.md) for more\r\n    information on how this file works.\r\n\r\n9. Add the following configuration to the file.\r\n\r\n      db:\r\n        image: postgres\r\n      web:\r\n        build: .\r\n        command: python manage.py runserver 0.0.0.0:8000\r\n        volumes:\r\n          - .:/code\r\n        ports:\r\n          - \"8000:8000\"\r\n        links:\r\n          - db\r\n\r\n    This file defines two services. The `db` service and the `web` service.\r\n\r\n10. Save and close the `docker-compose.yml` file.\r\n\r\n## Create a Django project\r\n\r\nIn this step, you create a Django project by building the image from the build context you provided in the previous procedure.\r\n\r\n1. Change to the root of your project directory.\r\n\r\n2. Run the application using the `docker-compose` command.\r\n\r\n        $ docker-compose run web django-admin.py startproject composeexample .\r\n\r\n    This instructions Compose to the run `django-admin.py startproject\r\n    composeexample` in a container. Before it can do this, Compose needs to know\r\n    what to build and it looks in the current directory for instructions. The\r\n    `docker-compose.yml` defines two services, the `web` service defines a `build`\r\n    context as the current (.) directory. Finding the Dockerfile, Compose uses\r\n    that to build the `web` service.\r\n\r\n    Once the `web` service image is built, Compose runs it and executes the\r\n    `django-admin.py startproject` command in the container. This command\r\n    writes a set of files representing a Django app into your project\r\n    directory:\r\n\r\n3. After the `docker-compose` command completes, list the contents of your project.\r\n\r\n        $ ls\r\n        Dockerfile       docker-compose.yml          composeexample       manage.py        requirements.txt\r\n\r\n## Connect the database\r\n\r\nIn this section, you set up the database connection for Django.\r\n\r\n1. In your project dirctory, edit the `composeexample/settings.py` file.\r\n\r\n2. Replace the `DATABASES = ...` with the following:\r\n\r\n        DATABASES = {\r\n            'default': {\r\n                'ENGINE': 'django.db.backends.postgresql_psycopg2',\r\n                'NAME': 'postgres',\r\n                'USER': 'postgres',\r\n                'HOST': 'db',\r\n                'PORT': 5432,\r\n            }\r\n        }\r\n\r\n    These settings are determined by the\r\n    [postgres](https://registry.hub.docker.com/_/postgres/) Docker image\r\n    specified in the Dockerfile.\r\n\r\n3. Save and close the file.\r\n\r\n4. Enter the `docker-compose up` command.\r\n\r\n        $ docker-compose up\r\n        Recreating myapp_db_1...\r\n        Recreating myapp_web_1...\r\n        Attaching to myapp_db_1, myapp_web_1\r\n        myapp_db_1 |\r\n        myapp_db_1 | PostgreSQL stand-alone backend 9.1.11\r\n        myapp_db_1 | 2014-01-27 12:17:03 UTC LOG:  database system is ready to accept connections\r\n        myapp_db_1 | 2014-01-27 12:17:03 UTC LOG:  autovacuum launcher started\r\n        myapp_web_1 | Validating models...\r\n        myapp_web_1 |\r\n        myapp_web_1 | 0 errors found\r\n        myapp_web_1 | January 27, 2014 - 12:12:40\r\n        myapp_web_1 | Django version 1.6.1, using settings 'composeexample.settings'\r\n        myapp_web_1 | Starting development server at http://0.0.0.0:8000/\r\n        myapp_web_1 | Quit the server with CONTROL-C.\r\n\r\n    At this point, your Django app should be running at port `8000` on your\r\n    Docker host. If you are using a Docker Machine VM, you can use the\r\n    `docker-machine ip MACHINE_NAME` to get the IP address.\r\n\r\n5. Try running some Compose management commands with Docker.\r\n\r\n    For example, open another terminal, change to your project directory and try the following commands.\r\n\r\n        $ docker-compose up\r\n        $ docker-compose run web python manage.py syncdb\r\n\r\n## More Compose documentation\r\n\r\n- [User guide](/)\r\n- [Installing Compose](install.md)\r\n- [Get started with Django](django.md)\r\n- [Get started with Rails](rails.md)\r\n- [Get started with Wordpress](wordpress.md)\r\n- [Command line reference](/reference)\r\n- [Yaml file reference](yml.md)\r\n- [Compose environment variables](env.md)\r\n- [Compose command line completion](completion.md)\r\n\r\n\r\n\r\n--->  ","created_at":"2015-09-24T23:57:57Z","updated_at":"2015-09-24T23:57:57Z","html_url":"https://github.com/docker/compose/pull/1994#discussion_r40387815","pull_request_url":"https://api.github.com/repos/docker/compose/pulls/1994","_links":{"self":{"href":"https://api.github.com/repos/docker/compose/pulls/comments/40387815"},"html":{"href":"https://github.com/docker/compose/pull/1994#discussion_r40387815"},"pull_request":{"href":"https://api.github.com/repos/docker/compose/pulls/1994"}}},"pull_request":{"url":"https://api.github.com/repos/docker/compose/pulls/1994","id":44292250,"html_url":"https://github.com/docker/compose/pull/1994","diff_url":"https://github.com/docker/compose/pull/1994.diff","patch_url":"https://github.com/docker/compose/pull/1994.patch","issue_url":"https://api.github.com/repos/docker/compose/issues/1994","number":1994,"state":"open","locked":false,"title":"Touchup \"Quickstart Guide: Compose and Django\"","user":{"login":"charleswhchan","id":679475,"avatar_url":"https://avatars.githubusercontent.com/u/679475?v=3","gravatar_id":"","url":"https://api.github.com/users/charleswhchan","html_url":"https://github.com/charleswhchan","followers_url":"https://api.github.com/users/charleswhchan/followers","following_url":"https://api.github.com/users/charleswhchan/following{/other_user}","gists_url":"https://api.github.com/users/charleswhchan/gists{/gist_id}","starred_url":"https://api.github.com/users/charleswhchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleswhchan/subscriptions","organizations_url":"https://api.github.com/users/charleswhchan/orgs","repos_url":"https://api.github.com/users/charleswhchan/repos","events_url":"https://api.github.com/users/charleswhchan/events{/privacy}","received_events_url":"https://api.github.com/users/charleswhchan/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Charles Chan <charleswhchan@users.noreply.github.com>","created_at":"2015-09-05T23:46:49Z","updated_at":"2015-09-24T23:57:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d39fa9e496741f02870e6111671816439823f8f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/compose/pulls/1994/commits","review_comments_url":"https://api.github.com/repos/docker/compose/pulls/1994/comments","review_comment_url":"https://api.github.com/repos/docker/compose/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/compose/issues/1994/comments","statuses_url":"https://api.github.com/repos/docker/compose/statuses/6acae833a048aeebd87458c94492a77061fe7fd7","head":{"label":"charleswhchan:patch-3","ref":"patch-3","sha":"6acae833a048aeebd87458c94492a77061fe7fd7","user":{"login":"charleswhchan","id":679475,"avatar_url":"https://avatars.githubusercontent.com/u/679475?v=3","gravatar_id":"","url":"https://api.github.com/users/charleswhchan","html_url":"https://github.com/charleswhchan","followers_url":"https://api.github.com/users/charleswhchan/followers","following_url":"https://api.github.com/users/charleswhchan/following{/other_user}","gists_url":"https://api.github.com/users/charleswhchan/gists{/gist_id}","starred_url":"https://api.github.com/users/charleswhchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleswhchan/subscriptions","organizations_url":"https://api.github.com/users/charleswhchan/orgs","repos_url":"https://api.github.com/users/charleswhchan/repos","events_url":"https://api.github.com/users/charleswhchan/events{/privacy}","received_events_url":"https://api.github.com/users/charleswhchan/received_events","type":"User","site_admin":false},"repo":{"id":41779171,"name":"compose","full_name":"charleswhchan/compose","owner":{"login":"charleswhchan","id":679475,"avatar_url":"https://avatars.githubusercontent.com/u/679475?v=3","gravatar_id":"","url":"https://api.github.com/users/charleswhchan","html_url":"https://github.com/charleswhchan","followers_url":"https://api.github.com/users/charleswhchan/followers","following_url":"https://api.github.com/users/charleswhchan/following{/other_user}","gists_url":"https://api.github.com/users/charleswhchan/gists{/gist_id}","starred_url":"https://api.github.com/users/charleswhchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleswhchan/subscriptions","organizations_url":"https://api.github.com/users/charleswhchan/orgs","repos_url":"https://api.github.com/users/charleswhchan/repos","events_url":"https://api.github.com/users/charleswhchan/events{/privacy}","received_events_url":"https://api.github.com/users/charleswhchan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/charleswhchan/compose","description":"Define and run multi-container applications with Docker","fork":true,"url":"https://api.github.com/repos/charleswhchan/compose","forks_url":"https://api.github.com/repos/charleswhchan/compose/forks","keys_url":"https://api.github.com/repos/charleswhchan/compose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/charleswhchan/compose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/charleswhchan/compose/teams","hooks_url":"https://api.github.com/repos/charleswhchan/compose/hooks","issue_events_url":"https://api.github.com/repos/charleswhchan/compose/issues/events{/number}","events_url":"https://api.github.com/repos/charleswhchan/compose/events","assignees_url":"https://api.github.com/repos/charleswhchan/compose/assignees{/user}","branches_url":"https://api.github.com/repos/charleswhchan/compose/branches{/branch}","tags_url":"https://api.github.com/repos/charleswhchan/compose/tags","blobs_url":"https://api.github.com/repos/charleswhchan/compose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/charleswhchan/compose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/charleswhchan/compose/git/refs{/sha}","trees_url":"https://api.github.com/repos/charleswhchan/compose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/charleswhchan/compose/statuses/{sha}","languages_url":"https://api.github.com/repos/charleswhchan/compose/languages","stargazers_url":"https://api.github.com/repos/charleswhchan/compose/stargazers","contributors_url":"https://api.github.com/repos/charleswhchan/compose/contributors","subscribers_url":"https://api.github.com/repos/charleswhchan/compose/subscribers","subscription_url":"https://api.github.com/repos/charleswhchan/compose/subscription","commits_url":"https://api.github.com/repos/charleswhchan/compose/commits{/sha}","git_commits_url":"https://api.github.com/repos/charleswhchan/compose/git/commits{/sha}","comments_url":"https://api.github.com/repos/charleswhchan/compose/comments{/number}","issue_comment_url":"https://api.github.com/repos/charleswhchan/compose/issues/comments{/number}","contents_url":"https://api.github.com/repos/charleswhchan/compose/contents/{+path}","compare_url":"https://api.github.com/repos/charleswhchan/compose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/charleswhchan/compose/merges","archive_url":"https://api.github.com/repos/charleswhchan/compose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/charleswhchan/compose/downloads","issues_url":"https://api.github.com/repos/charleswhchan/compose/issues{/number}","pulls_url":"https://api.github.com/repos/charleswhchan/compose/pulls{/number}","milestones_url":"https://api.github.com/repos/charleswhchan/compose/milestones{/number}","notifications_url":"https://api.github.com/repos/charleswhchan/compose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/charleswhchan/compose/labels{/name}","releases_url":"https://api.github.com/repos/charleswhchan/compose/releases{/id}","created_at":"2015-09-02T04:07:17Z","updated_at":"2015-09-02T04:07:18Z","pushed_at":"2015-09-15T18:31:00Z","git_url":"git://github.com/charleswhchan/compose.git","ssh_url":"git@github.com:charleswhchan/compose.git","clone_url":"https://github.com/charleswhchan/compose.git","svn_url":"https://github.com/charleswhchan/compose","homepage":"https://docs.docker.com/compose/","size":5166,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"9da2bf3973cc78cbdf141197fd3338b233245696","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":15045751,"name":"compose","full_name":"docker/compose","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/compose","description":"Define and run multi-container applications with Docker","fork":false,"url":"https://api.github.com/repos/docker/compose","forks_url":"https://api.github.com/repos/docker/compose/forks","keys_url":"https://api.github.com/repos/docker/compose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/compose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/compose/teams","hooks_url":"https://api.github.com/repos/docker/compose/hooks","issue_events_url":"https://api.github.com/repos/docker/compose/issues/events{/number}","events_url":"https://api.github.com/repos/docker/compose/events","assignees_url":"https://api.github.com/repos/docker/compose/assignees{/user}","branches_url":"https://api.github.com/repos/docker/compose/branches{/branch}","tags_url":"https://api.github.com/repos/docker/compose/tags","blobs_url":"https://api.github.com/repos/docker/compose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/compose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/compose/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/compose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/compose/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/compose/languages","stargazers_url":"https://api.github.com/repos/docker/compose/stargazers","contributors_url":"https://api.github.com/repos/docker/compose/contributors","subscribers_url":"https://api.github.com/repos/docker/compose/subscribers","subscription_url":"https://api.github.com/repos/docker/compose/subscription","commits_url":"https://api.github.com/repos/docker/compose/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/compose/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/compose/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/compose/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/compose/contents/{+path}","compare_url":"https://api.github.com/repos/docker/compose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/compose/merges","archive_url":"https://api.github.com/repos/docker/compose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/compose/downloads","issues_url":"https://api.github.com/repos/docker/compose/issues{/number}","pulls_url":"https://api.github.com/repos/docker/compose/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/compose/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/compose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/compose/labels{/name}","releases_url":"https://api.github.com/repos/docker/compose/releases{/id}","created_at":"2013-12-09T11:40:58Z","updated_at":"2015-09-24T17:54:08Z","pushed_at":"2015-09-24T22:11:01Z","git_url":"git://github.com/docker/compose.git","ssh_url":"git@github.com:docker/compose.git","clone_url":"https://github.com/docker/compose.git","svn_url":"https://github.com/docker/compose","homepage":"https://docs.docker.com/compose/","size":73431,"stargazers_count":6322,"watchers_count":6322,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":788,"mirror_url":null,"open_issues_count":381,"forks":788,"open_issues":381,"watchers":6322,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/compose/pulls/1994"},"html":{"href":"https://github.com/docker/compose/pull/1994"},"issue":{"href":"https://api.github.com/repos/docker/compose/issues/1994"},"comments":{"href":"https://api.github.com/repos/docker/compose/issues/1994/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/compose/pulls/1994/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/compose/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/compose/pulls/1994/commits"},"statuses":{"href":"https://api.github.com/repos/docker/compose/statuses/6acae833a048aeebd87458c94492a77061fe7fd7"}}}}