`collectstatic` error when deploying Django app to heroku

Blademaster

While deploying my Django app to heroku, but colletstatic method seems to throw lots of errors. I've tried several solutions posted online but none worked. By the way, I'm using whitenoise for serving my static files.

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: -----> Python app detected
remote: -----> Installing python-3.6.1
remote: -----> Installing pip
remote: -----> 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->-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: -----> $ python manage.py collectstatic --noinput
remote:        Traceback (most recent call last):
remote:          File "manage.py", line 22, in <module>
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 -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/habibam.git'
D. Evans

It's looking in the directory Nostradamus/static and throwing an error because that directory doesn't exist.

If that directory does exist locally then the problem might be that it's empty and so git doesn't track it. The simple solution to that is to create an empty file called .keep (or anything you like, it doesn't matter what it's called) in that directory which will cause git to "see" it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Error with collectstatic while deploying Django app to Heroku

Error deploying on Heroku - Django app - collectstatic --noinput

Where to run collectstatic when deploying django app to heroku using docker?

Collectstatic configuration error when deploying Django app with dokku

Getting an error when deploying a Django app to Heroku

python manage.py collectstatic --noinput error when deploying Django project to Heroku

Error when deploying Django-React app to Heroku

Unrecognised error when deploying django app to heroku with git push

PostgreSQL error when deploying jhipster app on Heroku

Error when deploying Angular app to Heroku

H14 Error regarding favicon when deploying Django app to Heroku

App not compatible with buildpack: error during deploying django app to heroku

Django Heroku Collectstatic error only on deploy

Error on deploying django app to Heroku -- TypeError: argument of type 'PosixPath' is not iterable

Running through an environmental error during deploying django app on heroku

Problem in collecting static files when deploying a Django Web App to Heroku

Heroku app successfully deploying, but receiving application error when loading site

Application error when deploying my Rails app to heroku

Why do I obtain this error when deploying app to Heroku?

Discord app error R10 when deploying with Heroku

403 error when deploying a Node.js app on Heroku

"ERROR: No matching distribution found for numpy" when deploying app to Heroku

"Cannot load such file" error when deploying Rails app to Heroku

Deploying Go app to heroku error

deploying flask app to heroku error

Error with deploying springboot app to heroku

error deploying django 2.0 to heroku

How to serve static files to AWS when deploying Django app (`python manage.py collectstatic` didn't work)?

Heroku not running collectstatic with Django