title: `collectstatic` error when deploying Django app to heroku
body: <p>While deploying my Django app to heroku, but <code>colletstatic</code> method seems to throw lots of errors. I've tried several solutions posted online but none worked. By the way, I'm using <code>whitenoise</code> for serving my static files.</p>
  
  <pre><code>Counting objects: 77, done.
  Delta compression using up to 12 threads.
  Compressing objects: 100% (74/74), done.
  Writing objects: 100% (77/77), 351.57 KiB | 0 bytes/s, done.
  Total 77 (delta 27), reused 0 (delta 0)
  remote: Compressing source files... done.
  remote: Building source:
  remote: 
  remote: -----&gt; Python app detected
  remote: -----&gt; Installing python-3.6.1
  remote: -----&gt; Installing pip
  remote: -----&gt; Installing requirements with pip
  remote:        Collecting Django==1.11.1 (from -r /tmp/build_d86f80f6593040bde7f9cb90828051e6/requirements.txt (line 1))
  remote:          Downloading Django-1.11.1-py2.py3-none-any.whl (6.9MB)
  remote:        Collecting gunicorn==19.7.1 (from -r /tmp/build_d86f80f6593040bde7f9cb90828051e6/requirements.txt (line 2))
  remote:          Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
  remote:        Collecting whitenoise==3.3.0 (from -r /tmp/build_d86f80f6593040bde7f9cb90828051e6/requirements.txt (line 3))
  remote:          Downloading whitenoise-3.3.0-py2.py3-none-any.whl
  remote:        Collecting psycopg2==2.7.1 (from -r /tmp/build_d86f80f6593040bde7f9cb90828051e6/requirements.txt (line 4))
  remote:          Downloading psycopg2-2.7.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
  remote:        Collecting pytz (from Django==1.11.1-&gt;-r /tmp/build_d86f80f6593040bde7f9cb90828051e6/requirements.txt (line 1))
  remote:          Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
  remote:        Installing collected packages: pytz, Django, gunicorn, whitenoise, psycopg2
  remote:        Successfully installed Django-1.11.1 gunicorn-19.7.1 psycopg2-2.7.1 pytz-2017.2 whitenoise-3.3.0
  remote: 
  remote: -----&gt; $ python manage.py collectstatic --noinput
  remote:        Traceback (most recent call last):
  remote:          File "manage.py", line 22, in &lt;module&gt;
  remote:            execute_from_command_line(sys.argv)
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
  remote:            utility.execute()
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
  remote:            self.fetch_command(subcommand).run_from_argv(self.argv)
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
  remote:            self.execute(*args, **cmd_options)
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
  remote:            output = self.handle(*args, **options)
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 199, in handle
  remote:            collected = self.collect()
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 115, in collect
  remote:            for path, storage in finder.list(self.ignore_patterns):
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
  remote:            for path in utils.get_files(storage, ignore_patterns):
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
  remote:            directories, files = storage.listdir(location)
  remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 397, in listdir
  remote:            for entry in os.listdir(path):
  remote:        FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_d86f80f6593040bde7f9cb90828051e6/Nostradamus/static'
  remote: 
  remote:  !     Error while running '$ python manage.py collectstatic --noinput'.
  remote:        See traceback above for details.
  remote: 
  remote:        You may need to update application code to resolve this error.
  remote:        Or, you can disable collectstatic for this application:
  remote: 
  remote:           $ heroku config:set DISABLE_COLLECTSTATIC=1
  remote: 
  remote:        https://devcenter.heroku.com/articles/django-assets
  remote: 
  remote: ****** Collectstatic environment variables:
  remote: 
  remote:        CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
  remote:        EXPORT_PATH=/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/bin/../export
  remote:        SOURCE_VERSION=438c510c80b83b0d88b66ca02b9c8563e930b185
  remote:        PROFILE_PATH=/tmp/build_d86f80f6593040bde7f9cb90828051e6/.profile.d/python.sh
  remote:        DEBUG_COLLECTSTATIC=0
  remote:        BUILDPACK_LOG_FILE=/dev/fd/3
  remote:        LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
  remote:        CACHE_DIR=/app/tmp/cache
  remote:        PYTHONUNBUFFERED=1
  remote:        PYHONHOME=/tmp/build_d86f80f6593040bde7f9cb90828051e6/.heroku/python
  remote:        LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
  remote:        BIN_DIR=/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/bin
  remote:        DYNO=run.7199
  remote:        PATH=/app/.heroku/python/bin:/app/.heroku/vendor/bin::/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/vendor/:/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/vendor/pip-pop
  remote:        RECOMMENDED_PYTHON_VERSION=python-2.7.13
  remote:        C_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
  remote:        PWD=/tmp/build_d86f80f6593040bde7f9cb90828051e6
  remote:        BPLOG_PREFIX=buildpack.python
  remote:        LANG=en_US.UTF-8
  remote:        STACK=heroku-16
  remote:        SHLVL=3
  remote:        REQUEST_ID=27f7a88e-8898-45ab-b6ef-d7792fdb0a7a
  remote:        HOME=/app
  remote:        PYTHONPATH=/tmp/build_d86f80f6593040bde7f9cb90828051e6/
  remote:        BUILD_DIR=/tmp/build_d86f80f6593040bde7f9cb90828051e6
  remote:        WARNINGS_LOG=/tmp/tmp.3UgKi9FCcP
  remote:        PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkgconfig:/app/.heroku/vendor/lib/pkgconfig:/app/.heroku/vendor/lib/pkg-config:/app/.heroku/python/lib/pkg-config:
  remote:        _=/usr/bin/env
  remote:  !     Push rejected, failed to compile Python app.
  remote: 
  remote:  !     Push failed
  remote: Verifying deploy...
  remote: 
  remote: !   Push rejected to habibam.
  remote: 
  To https://git.heroku.com/habibam.git
   ! [remote rejected] master -&gt; master (pre-receive hook declined)
  error: failed to push some refs to 'https://git.heroku.com/habibam.git'
  </code></pre>