Exception in worker process: No module named wsgi
<p>I am trying to deploy my Django web app on heroku.
An Application error message appears to me when I try to open it.</p>

<p>this is my log:</p>

<pre><code>2016-09-27T07:56:16.836350+00:00 heroku[web.1]: State changed from crashed to starting
2016-09-27T07:56:21.160909+00:00 heroku[web.1]: Starting process with command `gunicorn myblog.wsgi --log-file -`
2016-09-27T07:56:24.063399+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [3] [INFO] Listening at: http://0.0.0.0:37485 (3)
2016-09-27T07:56:24.062805+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [3] [INFO] Starting gunicorn 19.4.5
2016-09-27T07:56:24.063556+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [3] [INFO] Using worker: sync
2016-09-27T07:56:24.066328+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [9] [INFO] Booting worker with pid: 9
2016-09-27T07:56:24.069171+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [9] [ERROR] Exception in worker process:
2016-09-27T07:56:24.069172+00:00 app[web.1]: Traceback (most recent call last):
2016-09-27T07:56:24.069175+00:00 app[web.1]:     worker.init_process()
2016-09-27T07:56:24.069175+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-09-27T07:56:24.069176+00:00 app[web.1]:     self.load_wsgi()
2016-09-27T07:56:24.069174+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-09-27T07:56:24.069177+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-09-27T07:56:24.069178+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-09-27T07:56:24.069179+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-09-27T07:56:24.069179+00:00 app[web.1]:     self.callable = self.load()
2016-09-27T07:56:24.069180+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-09-27T07:56:24.069181+00:00 app[web.1]:     return self.load_wsgiapp()
2016-09-27T07:56:24.069181+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-09-27T07:56:24.069182+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-09-27T07:56:24.069183+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-09-27T07:56:24.069183+00:00 app[web.1]:     __import__(module)
2016-09-27T07:56:24.069185+00:00 app[web.1]: Traceback (most recent call last):
2016-09-27T07:56:24.069185+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-09-27T07:56:24.069186+00:00 app[web.1]:     worker.init_process()
2016-09-27T07:56:24.069184+00:00 app[web.1]: ImportError: No module named wsgi
2016-09-27T07:56:24.069186+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-09-27T07:56:24.069187+00:00 app[web.1]:     self.load_wsgi()
2016-09-27T07:56:24.069188+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-09-27T07:56:24.069188+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-09-27T07:56:24.069189+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-09-27T07:56:24.069189+00:00 app[web.1]:     self.callable = self.load()
2016-09-27T07:56:24.069190+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-09-27T07:56:24.069191+00:00 app[web.1]:     return self.load_wsgiapp()
2016-09-27T07:56:24.069191+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-09-27T07:56:24.069192+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-09-27T07:56:24.069193+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-09-27T07:56:24.069193+00:00 app[web.1]:     __import__(module)
2016-09-27T07:56:24.069194+00:00 app[web.1]: ImportError: No module named wsgi
2016-09-27T07:56:24.069351+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [9] [INFO] Worker exiting (pid: 9)
2016-09-27T07:56:24.088872+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [3] [INFO] Shutting down: Master
2016-09-27T07:56:24.089020+00:00 app[web.1]: [2016-09-27 07:56:24 +0000] [3] [INFO] Reason: Worker failed to boot.
2016-09-27T07:56:24.210605+00:00 heroku[web.1]: State changed from starting to crashed
2016-09-27T07:56:24.197593+00:00 heroku[web.1]: Process exited with status 3
</code></pre>

<p>the errors I noticed in the log are:</p>

<ul>
<li>[ERROR] Exception in worker process:</li>
<li>ImportError: No module named wsg</li>
</ul>

<p>my procfile: (my app is called myblog)</p>

<pre><code>web: gunicorn myblog.wsgi --log-file -
</code></pre>

<p>requirements.txt:</p>

<pre><code>Django==1.9.2
argparse==1.2.1
dj-database-url==0.4.0
dj-static==0.0.6
django-toolbelt==0.0.1
gunicorn==19.4.5
psycopg2==2.6.1
static3==0.7.0
whitenoise==2.0.6
wsgiref==0.1.2
</code></pre>

<p>NOTE :: I Disabled the Collectstatic using this command</p>

<pre><code>heroku config:set DISABLE_COLLECTSTATIC=1
</code></pre>

<p>EDIT::---------------------------------------------------</p>

<p>my wsgi.py file:</p>

<pre><code>import os

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blog.settings")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)
</code></pre>

<p>my project structure:</p>

<pre><code>Django-Blog
   /blog
      settings.py
      urls.py
      wsgi.py
      __init__.py
   /myblog
   manage.py
   requirements.txt
   procfile
   runtime.txt
   /venv
</code></pre>

<p>.gitignore file:</p>

<pre><code># Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject


myblog/static/myblog/images/
myblog/migrations/

.idea/workspace.xml
</code></pre>

<p>change your procfile to :</p>

<p><code>web: gunicorn blog.wsgi --log-file -</code></p>

python django heroku wsgi