title: Django startapp workflow with docker
body: <p>I am confused with how to work with Django apps (create/using) when using Docker. Some of the tutorials suggest using command startapp after starting the web docker container (I'm using docker-compose to up the containers). But since the files are created inside that container, how do I go about adding code to that from my local dev machine? and moreover, this does not seem right to create apps like this to edit code... </p>
  
  <p>I've been using this following structure as is so far which starts up the container and works fine. But with just one "app" which is todo
  (taken from <a href="https://github.com/realpython/dockerizing-django" rel="nofollow noreferrer">https://github.com/realpython/dockerizing-django</a>)</p>
  
  <pre><code>.
  ├── README.md
  ├── docker-compose.yml
  ├── nginx
  │   ├── Dockerfile
  │   └── sites-enabled
  │       └── django_project
  ├── production.yml
  ├── tmp.json
  └── web
      ├── Dockerfile
      ├── Pipfile
      ├── Pipfile.lock
      ├── docker_django
      │   ├── __init__.py
      │   ├── apps
      │   │   ├── __init__.py
      │   │   └── todo
      │   │       ├── __init__.py
      │   │       ├── admin.py
      │   │       ├── models.py
      │   │       ├── static
      │   │       │   └── main.css
      │   │       ├── templates
      │   │       │   ├── _base.html
      │   │       │   ├── dashboard.html
      │   │       │   └── home.html
      │   │       ├── tests.py
      │   │       ├── urls.py
      │   │       └── views.py
      │   ├── settings.py
      │   ├── urls.py
      │   └── wsgi.py
      ├── manage.py
      ├── requirements.txt
      ├── shell-script.sh
      └── tests
          ├── __init__.py
          └── test_env_settings.py
  </code></pre>
  
  <p>When I use the above structure, I am not able to create apps locally as we have to use manage.py to create apps, but I need to navigate to apps folder to do that but manage.py is not accessible. So, I try to give full abs path to manage.py, but it complains about SeTTINGS_MODULE SECRET_KEY error. </p>
  
  <p>What is the proper way to work with django apps when using Docker-Compose? </p>
  
  <p>Do I need to change the above structure? or should I change my workflow?</p>
  
  <p>EDIT:</p>
  
  <p>my docker-compose:</p>
  
  <pre><code>version: '3.7'
  
  services:
    web:
      restart: always
      build: ./web
      expose:
        - "8000"
      links:
        - postgres:postgres
        - redis:redis
      volumes:
        - web-django:/usr/src/app
        - web-static:/usr/src/app/static
      env_file: .env
      environment:
        DEBUG: 'true'
      command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000
  
    nginx:
      restart: always
      build: ./nginx/
      ports:
        - "80:80"
      volumes:
        - web-static:/usr/src/app/static
      links:
        - web:web
  
    postgres:
      restart: always
      image: postgres:latest
      ports:
        - "5432:5432"
      volumes:
        - pgdata:/var/lib/postgresql/data/
  
    pgadmin:
      restart: always
      image: fenglc/pgadmin4
      ports:
        - "5050:5050"
      volumes:
        - pgadmindata:/var/lib/pgadmin/data/
      environment:
        DEFAULT_USER: 'pgadmin4@pgadmin.org'
        DEFAULT_PASSWORD: 'admin'
  
    redis:
      restart: always
      image: redis:latest
      ports:
        - "6379:6379"
      volumes:
        - redisdata:/data
  
  volumes:
    web-django:
    web-static:
    pgdata:
    redisdata:
    pgadmindata:
  </code></pre>
  
  <p>My Dockerfile inside web folder:</p>
  
  <pre><code>FROM python:3.7-slim
  
  # Set environment variables
  
  ENV PYTHONDONTWRITEBYTECODE 1
  ENV PYTHONUNBUFFERED 1
  
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  ADD Pipfile /usr/src/app
  ADD Pipfile.lock /usr/src/app
  
  RUN python -m pip install --upgrade pip
  
  RUN python -m pip install pipenv
  
  COPY requirements.txt requirements.txt
  RUN pipenv install --system
  
  COPY . /usr/src/app
  </code></pre>