title: In Heroku, how to running gunicorn & import whitenoise?
body: <pre><code>2020-10-01T03:28:40.496699+00:00 heroku[web.1]: Starting process with command `gunicorn Nstory.wsgi --log-file -`
  2020-10-01T03:28:43.803839+00:00 heroku[web.1]: State changed from starting to up
  2020-10-01T03:28:43.367859+00:00 app[web.1]: [2020-10-01 03:28:43 +0000] [4] [INFO] Starting gunicorn 20.0.4
  2020-10-01T03:28:43.368669+00:00 app[web.1]: [2020-10-01 03:28:43 +0000] [4] [INFO] Listening at: http://0.0.0.0:35650 (4)
  2020-10-01T03:28:43.368936+00:00 app[web.1]: [2020-10-01 03:28:43 +0000] [4] [INFO] Using worker: sync
  2020-10-01T03:28:43.374298+00:00 app[web.1]: [2020-10-01 03:28:43 +0000] [9] [INFO] Booting worker with pid: 9
  2020-10-01T03:28:43.382660+00:00 app[web.1]: [2020-10-01 03:28:43 +0000] [10] [INFO] Booting worker with pid: 10
  2020-10-01T03:28:44.338145+00:00 app[web.1]: [2020-10-01 12:28:44 +0900] [9] [ERROR] Exception in worker process
  2020-10-01T03:28:44.338188+00:00 app[web.1]: Traceback (most recent call last):
  2020-10-01T03:28:44.338190+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker
  2020-10-01T03:28:44.338191+00:00 app[web.1]: worker.init_process()
  2020-10-01T03:28:44.338191+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py&quot;, line 119, in init_process
  2020-10-01T03:28:44.338192+00:00 app[web.1]: self.load_wsgi()
  2020-10-01T03:28:44.338192+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi
  2020-10-01T03:28:44.338192+00:00 app[web.1]: self.wsgi = self.app.wsgi()
  2020-10-01T03:28:44.338193+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py&quot;, line 67, in wsgi
  2020-10-01T03:28:44.338193+00:00 app[web.1]: self.callable = self.load()
  2020-10-01T03:28:44.338194+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load
  2020-10-01T03:28:44.338194+00:00 app[web.1]: return self.load_wsgiapp()
  2020-10-01T03:28:44.338195+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp
  2020-10-01T03:28:44.338195+00:00 app[web.1]: return util.import_app(self.app_uri)
  2020-10-01T03:28:44.338195+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py&quot;, line 358, in import_app
  2020-10-01T03:28:44.338196+00:00 app[web.1]: mod = importlib.import_module(module)
  2020-10-01T03:28:44.338196+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/importlib/__init__.py&quot;, line 127, in import_module
  2020-10-01T03:28:44.338197+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
  2020-10-01T03:28:44.338198+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import
  2020-10-01T03:28:44.338198+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
  2020-10-01T03:28:44.338199+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 975, in _find_and_load_unlocked
  2020-10-01T03:28:44.338199+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 671, in _load_unlocked
  2020-10-01T03:28:44.338199+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module
  2020-10-01T03:28:44.338200+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
  2020-10-01T03:28:44.338200+00:00 app[web.1]: File &quot;/app/Nstory/wsgi.py&quot;, line 19, in &lt;module&gt;
  2020-10-01T03:28:44.338200+00:00 app[web.1]: from whitenoise.django import DjangoWhiteNoise
  2020-10-01T03:28:44.338201+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/whitenoise/django.py&quot;, line 1, in &lt;module&gt;
  2020-10-01T03:28:44.338201+00:00 app[web.1]: raise ImportError(
  2020-10-01T03:28:44.338202+00:00 app[web.1]: ImportError:
  2020-10-01T03:28:44.338202+00:00 app[web.1]:
  2020-10-01T03:28:44.338203+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
  2020-10-01T03:28:44.338203+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
  2020-10-01T03:28:44.338203+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
  2020-10-01T03:28:44.338204+00:00 app[web.1]:
  2020-10-01T03:28:44.338204+00:00 app[web.1]:
  2020-10-01T03:28:44.338364+00:00 app[web.1]: [2020-10-01 12:28:44 +0900] [9] [INFO] Worker exiting (pid: 9)
  2020-10-01T03:28:44.357550+00:00 app[web.1]: [2020-10-01 12:28:44 +0900] [10] [ERROR] Exception in worker process
  2020-10-01T03:28:44.357552+00:00 app[web.1]: Traceback (most recent call last):
  2020-10-01T03:28:44.357553+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker
  2020-10-01T03:28:44.357554+00:00 app[web.1]: worker.init_process()
  2020-10-01T03:28:44.357555+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py&quot;, line 119, in init_process
  2020-10-01T03:28:44.357555+00:00 app[web.1]: self.load_wsgi()
  2020-10-01T03:28:44.357556+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi
  2020-10-01T03:28:44.357556+00:00 app[web.1]: self.wsgi = self.app.wsgi()
  2020-10-01T03:28:44.357559+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py&quot;, line 67, in wsgi
  2020-10-01T03:28:44.357560+00:00 app[web.1]: self.callable = self.load()
  2020-10-01T03:28:44.357560+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load
  2020-10-01T03:28:44.357561+00:00 app[web.1]: return self.load_wsgiapp()
  2020-10-01T03:28:44.357561+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp
  2020-10-01T03:28:44.357561+00:00 app[web.1]: return util.import_app(self.app_uri)
  2020-10-01T03:28:44.357567+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py&quot;, line 358, in import_app
  2020-10-01T03:28:44.357568+00:00 app[web.1]: mod = importlib.import_module(module)
  2020-10-01T03:28:44.357568+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/importlib/__init__.py&quot;, line 127, in import_module
  2020-10-01T03:28:44.357569+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
  2020-10-01T03:28:44.357569+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import
  2020-10-01T03:28:44.357569+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
  2020-10-01T03:28:44.357570+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 975, in _find_and_load_unlocked
  2020-10-01T03:28:44.357585+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 671, in _load_unlocked
  2020-10-01T03:28:44.357586+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module
  2020-10-01T03:28:44.357586+00:00 app[web.1]: File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
  2020-10-01T03:28:44.357587+00:00 app[web.1]: File &quot;/app/Nstory/wsgi.py&quot;, line 19, in &lt;module&gt;
  2020-10-01T03:28:44.357587+00:00 app[web.1]: from whitenoise.django import DjangoWhiteNoise
  2020-10-01T03:28:44.357588+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.8/site-packages/whitenoise/django.py&quot;, line 1, in &lt;module&gt;
  2020-10-01T03:28:44.357588+00:00 app[web.1]: raise ImportError(
  2020-10-01T03:28:44.357588+00:00 app[web.1]: ImportError:
  2020-10-01T03:28:44.357589+00:00 app[web.1]:
  2020-10-01T03:28:44.357589+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
  2020-10-01T03:28:44.357590+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
  2020-10-01T03:28:44.357590+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
  2020-10-01T03:28:44.357590+00:00 app[web.1]:
  2020-10-01T03:28:44.357591+00:00 app[web.1]:
  2020-10-01T03:28:44.357945+00:00 app[web.1]: [2020-10-01 12:28:44 +0900] [10] [INFO] Worker exiting (pid: 10)
  2020-10-01T03:28:44.641942+00:00 app[web.1]: [2020-10-01 03:28:44 +0000] [4] [INFO] Shutting down: Master
  2020-10-01T03:28:44.642070+00:00 app[web.1]: [2020-10-01 03:28:44 +0000] [4] [INFO] Reason: Worker failed to boot.
  </code></pre>
  <p>I've tried running gunicorn and import whitenoise. like import <code>from whitenoise.django import DjangoWhiteNoise</code> and add MIDDLEWARE <code>'whitenoise.middleware.WhiteNoiseMiddleware',</code> and define staticfiles_storage like <code>STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'</code>
  but it didn't work...</p>
  <p>I've seen heroku django tutorials, and mozila tutorials <code>https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment</code> and <code>https://devcenter.heroku.com/articles/django-app-configuration</code>
  so I've tried change configuration about static files, and import whitenoise.
  but it didn't help.</p>
  <p>What makes Import Error?
  How can I deploy my site?</p>