title: docker-compose exec web python manage.py makemigrations problem
body: <h1>Problem</h1>
  <p>I created a new Django project and tried to change the database from default to PostgreSQL. After changing the <code>DATABASES</code> in settings.py, I tried to run <code>python manage.py migrate</code> in local environment and docker-compose containers. While it worked ok in local settings, the docker-compose didn't. It throws <code>django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'</code>. error. So, is there any way to fix this?</p>
  <h1>Steps to replicate the error</h1>
  <p>OS: WSL Ubuntu 4.4.0-18362-Microsoft</p>
  <ol>
  <li><code>docker-compose up -d</code></li>
  <li><code>docker-compose exec web pipenv install psycopg2-binary==2.8.4</code></li>
  <li><code>docker-compose down</code></li>
  <li><code>docker-compose exec web python manage.py migrate</code></li>
  </ol>
  <h1>Database settings and Docker Files</h1>
  <pre><code>DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'postgres',
          'USER': 'postgres',
          'PASSWORD': 'Bardwolf@314',
          'HOST': 'localhost',
          'PORT': 5432
      }
  }
  </code></pre>
  <h2>My docker-compose.yml, Dockerfile</h2>
  <h3>Dockerfile</h3>
  <pre><code>FROM python:3.8
  
  ENV PYTHONDONTWRITEBYTECODE 1
  ENV PYTHONUNBUFFERED 1
  
  WORKDIR /code
  
  COPY Pipfile Pipfile.lock /code/
  
  RUN pip install pipenv &amp;&amp; pipenv install --system
  RUN pipenv run pip install psycopg2-binary==2.8.4
  
  COPY . /code/
  </code></pre>
  <h3>docker-compose.yml</h3>
  <pre><code>version: '3.7'
  
  services:
      web:
          build: .
          command: python /code/manage.py runserver 0.0.0.0:8080
          volumes:
              - ./code
          
          ports:
              - 8080:8080
          depends_on:
              - db
          
      db:
          image: postgres:11
  </code></pre>