title: Dockerizing Django application: ModuleNotFoundError: No module named 'X"
body: <p>I've been trying to follow this guide to Dockerize a project:</p>
  
  <p><a href="https://dev.to/joekreydt/deploy-django-in-a-docker-container--41n6" rel="nofollow noreferrer">Deploy and Run Django in Dokcer Container</a></p>
  
  <p>This is the base file structure:</p>
  
  <pre><code>WFMBCM
  |-WFMBCM
  | |-__init__.py
  | |-__pycache__
  | |-setting.py
  | |-url.py
  | |-wsgi.py
  |
  |-WFMBCM_App
  |-WFMBCM_db
  |-manage.py
  |-Dockerfile
  |-requirements.txt
  |-runWFMBCM.sh
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM python:3.7
  ADD WFMBCM /usr/src/app
  ADD WFMBCM_App /usr/src/app
  ADD WFMBCM_db /usr/src/app
  ADD manage.py /usr/src/app
  WORKDIR /usr/src/app
  COPY requirements.txt ./
  RUN pip install --no-cache-dir -r requirements.txt
  EXPOSE 8000
  CMD exec gunicorn wfmbcm.wsgi:application --bind 0.0.0.0:8000 --workers 3
  </code></pre>
  
  <p>requirements.txt:</p>
  
  <pre><code>Django==2.2.1
  gunicorn==19.9.0
  </code></pre>
  
  <p>runWFMBCM.sh:</p>
  
  <pre><code>cd /home/admin/WFMBCM
  echo -e "\033[0;34mGo to WFMBCM directory.\n \033[0;37m"
  echo -e "\033[0;34mRemove old WFMBCM container\n \033[0;37m"
  docker rm -v wfmbcm_container 
  echo -e "\033[0;34m\nBuild WFMBCM Docker image.\n \033[0;37m"
  sudo docker build -t wfmbcm .
  echo -e "\033[0;34m\nRun WFMBCM Docker image.\n \033[0;37m"
  sudo docker run --name wfmbcm_container -p 8000:8000 -i -t wfmbcm
  echo -e "\033[0;34m\n\nWFMBCM run-script ended!.\n \033[0;37m"
  </code></pre>
  
  <p>When I run runWFMBCM.sh I get the following output:</p>
  
  <pre><code>Go to WFMBCM directory.
  
  Remove old WFMBCM container
  
  Error response from daemon: No such container: wfmbcm_container
  
  Build WFMBCM Docker image.
  
  Sending build context to Docker daemon  265.2kB
  Step 1/10 : FROM python:3.7
   ---&gt; cc971a68c3e4
  Step 2/10 : ADD WFMBCM /usr/src/app
   ---&gt; Using cache
   ---&gt; 302346d017e2
  Step 3/10 : ADD WFMBCM_App /usr/src/app
   ---&gt; Using cache
   ---&gt; 18bc8eb69946
  Step 4/10 : ADD WFMBCM_db /usr/src/app
   ---&gt; Using cache
   ---&gt; 0835393b22dc
  Step 5/10 : ADD manage.py /usr/src/app
   ---&gt; Using cache
   ---&gt; 3ef5477e4b26
  Step 6/10 : WORKDIR /usr/src/app
   ---&gt; Using cache
   ---&gt; 2edb019a8257
  Step 7/10 : COPY requirements.txt ./
   ---&gt; Using cache
   ---&gt; df3ac922b7a0
  Step 8/10 : RUN pip install --no-cache-dir -r requirements.txt
   ---&gt; Using cache
   ---&gt; ba6cf54e7dcc
  Step 9/10 : EXPOSE 8000
   ---&gt; Using cache
   ---&gt; 94f3f4fb38c0
  Step 10/10 : CMD exec gunicorn wfmbcm.wsgi:application --bind 0.0.0.0:8000 --workers 3
   ---&gt; Using cache
   ---&gt; db6cf2149949
  Successfully built db6cf2149949
  Successfully tagged wfmbcm:latest
  
  Run WFMBCM Docker image.
  
  [2019-05-26 09:59:36 +0000] [1] [INFO] Starting gunicorn 19.9.0
  [2019-05-26 09:59:36 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
  [2019-05-26 09:59:36 +0000] [1] [INFO] Using worker: sync
  [2019-05-26 09:59:36 +0000] [9] [INFO] Booting worker with pid: 9
  [2019-05-26 09:59:36 +0000] [10] [INFO] Booting worker with pid: 10
  [2019-05-26 09:59:36 +0000] [9] [ERROR] Exception in worker process
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
      self.load_wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
      return self.load_wsgiapp()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
      __import__(module)
  ModuleNotFoundError: No module named 'wfmbcm'
  [2019-05-26 09:59:36 +0000] [9] [INFO] Worker exiting (pid: 9)
  [2019-05-26 09:59:36 +0000] [11] [INFO] Booting worker with pid: 11
  [2019-05-26 09:59:36 +0000] [10] [ERROR] Exception in worker process
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
      self.load_wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
      return self.load_wsgiapp()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
      __import__(module)
  ModuleNotFoundError: No module named 'wfmbcm'
  [2019-05-26 09:59:36 +0000] [10] [INFO] Worker exiting (pid: 10)
  [2019-05-26 09:59:36 +0000] [11] [ERROR] Exception in worker process
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
      self.load_wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
      return self.load_wsgiapp()
    File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
      __import__(module)
  ModuleNotFoundError: No module named 'wfmbcm'
  [2019-05-26 09:59:36 +0000] [11] [INFO] Worker exiting (pid: 11)
  [2019-05-26 09:59:37 +0000] [1] [INFO] Shutting down: Master
  [2019-05-26 09:59:37 +0000] [1] [INFO] Reason: Worker failed to boot.
  
  
  WFMBCM run-script ended!.
  </code></pre>
  
  <p>Why can't it find wfmbcm module? I've been staring crazy and googling without success and looking at different stack overflow questions.</p>