title: Deploying project in Docker with Angular 4, Django and postgresql
body: <p>I am trying to deploy on Heroku my project in Docker with Angular 4 frontend with Django backend and postgresql database. At this moment my files look as shown below. I am note sure if this is done properly? I pushed it using <code>heroku container:push web --app myproject</code> but it doesn't work (Logs). I assume that if I use Docker I don't have to create Procfile etc.? May the error be caused by lack of migration of database?</p>
  
  <p>I have no idea that I'm moving into the right direction but I'm trying to migrate my database. Maybe my error is caused by lack of db? </p>
  
  <p>When I run <code>heroku run python manage.py migrate</code>, I get:</p>
  
  <blockquote>
    <p>django.db.utils.OperationalError: could not translate host name "db"
    to address: Name or service not known</p>
  </blockquote>
  
  <p>Logs:</p>
  
  <pre><code>2017-07-07T10:27:30.448951+00:00 heroku[web.1]: State changed from crashed to starting
  2017-07-07T10:27:30.436282+00:00 heroku[web.1]: Process exited with status 0
  2017-07-07T10:27:50.846928+00:00 heroku[web.1]: Starting process with command `python3`
  2017-07-07T10:27:53.350381+00:00 heroku[web.1]: Process exited with status 0
  2017-07-07T10:27:53.365013+00:00 heroku[web.1]: State changed from starting to crashed
  2017-07-07T10:27:53.876208+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= myproject.herokuapp.com request_id=e1f8edfc-7dc4-4bd3-91be-0a853e948452 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  2017-07-07T10:28:43.444860+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= myproject.herokuapp.com request_id=361846d1-41cd-403a-989f-4c29a0d1179e fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  2017-07-07T10:28:43.984059+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host= myproject.herokuapp.com request_id=658795c8-0ba7-4988-9d39-34601b1334c7 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  2017-07-07T10:28:44.673789+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= myproject.herokuapp.com request_id=63fbabdc-7ba7-4997-81be-c601a0d83368 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  2017-07-07T10:29:53.091547+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= myproject.herokuapp.com request_id=a3943544-9dc4-44f0-b788-a462cdfba7d0 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  2017-07-07T10:29:54.419623+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= myproject.herokuapp.com request_id=eb5191e2-21d9-410c-823e-c57bb0fb7fa4 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https
  </code></pre>
  
  <p>Project tree:</p>
  
  <pre><code>├── Backend
  │   ├── AI
  │   │   ├── __init__.py
  │   │   ├── __pycache__
  │   │   │   ├── __init__.cpython-36.pyc
  │   │   │   ├── settings.cpython-36.pyc
  │   │   │   ├── urls.cpython-36.pyc
  │   │   │   └── wsgi.cpython-36.pyc
  │   │   ├── settings.py
  │   │   ├── urls.py
  │   │   └── wsgi.py
  │   └── manage.py
  ├── Dockerfile
  ├── init.sql
  ├── Frontend
  │   └── angularProject
          ├── Dockerfile
  │       └── all files in my angular project 
  ├── docker-compose.yml
  └── requirements.txt
  </code></pre>
  
  <p>Frontend's Dockerfile:</p>
  
  <pre><code># Create image based on the official Node 6 image from dockerhub
  FROM node:6
  
  # Create a directory where our app will be placed
  RUN mkdir -p /usr/src/app
  
  # Change directory so that our commands run inside this new directory
  WORKDIR /usr/src/app
  
  # Copy dependency definitions
  COPY package.json /usr/src/app
  
  # Install dependecies
  RUN npm install
  
  # Get all the code needed to run the app
  COPY . /usr/src/app
  
  # Expose the port the app runs in
  EXPOSE 4200
  
  # Serve the app
  CMD ["npm", "start"]
  </code></pre>
  
  <p>Main directory's Dockerfile:</p>
  
  <pre><code>FROM python:3.6.1
  ENV PYTHONUNBUFFERED 1
  RUN mkdir /code
  WORKDIR /code
  ADD requirements.txt /code/
  RUN pip3 install -r requirements.txt
  ADD . /code/
  </code></pre>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '3'
  
  services:
    db:
      image: postgres
      environment:
        POSTGRES_USER: aso
        POSTGRES_PASSWORD: somepass
    django:
      build: .
      command: python3 MainDirectory/backend/myProject/manage.py runserver 0.0.0.0:8001
      volumes:
        - .:/code
      ports:
        - "8001:8001"
      depends_on:
        - db
    angular:
      build: MainDirectory/frontend
      ports:
        - "4200:4200"
      depends_on:
        - django
  </code></pre>
  
  <p>init.sql:</p>
  
  <pre><code>CREATE USER myUser;
  CREATE DATABASE myProject;
  GRANT ALL PRIVILEGES ON DATABASE myProject TO myUser;
  </code></pre>