Person, good evening.
Can anyone help me?
I have the following problem when installing the static files. It looks like the static folder is not being recognized.
When I run the command
$ git push heroku master
The following error occurs:
(venv) gabriel@gabriel-Aspire-F5-573:~/Área de Trabalho/Curso/venv/projetofinal2$ heroku create
Creating app... done, ⬢ shrouded-springs-78357
https://shrouded-springs-78357.herokuapp.com/ | https://git.heroku.com/shrouded-springs-78357.git
(venv) gabriel@gabriel-Aspire-F5-573:~/Área de Trabalho/Curso/venv/projetofinal2$ git push heroku master
Counting objects: 114, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (99/99), done.
Writing objects: 100% (114/114), 325.31 KiB | 0 bytes/s, done.
Total 114 (delta 27), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.7
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting dj-database-url==0.5.0 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
remote: Collecting dj-static==0.0.6 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/2b/8f/77a4b8ec50c821193bf9682c7896f12fd0418eb3711a7d66796ede59c23b/dj-static-0.0.6.tar.gz
remote: Collecting Django==2.0.9 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/6c/9d/c0feec696b815708354a2fd06ae0f51330a15043822a29bc8be2f185d9fe/Django-2.0.9-py3-none-any.whl (7.1MB)
remote: Collecting django-multiselectfield==0.1.8 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 4))
remote: Downloading https://files.pythonhosted.org/packages/c4/39/792bb001beb9cfd7f8dc5d88edb80963de0ae281b77be79038c0fe50582b/django-multiselectfield-0.1.8.tar.gz
remote: Collecting django-toolbelt==0.0.1 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 5))
remote: Downloading https://files.pythonhosted.org/packages/f0/d5/c7be87a43b5b15181134a4b035c226110266acd6a4b6079ba3b797f697fa/django-toolbelt-0.0.1.tar.gz
remote: Collecting gunicorn==19.9.0 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 6))
remote: Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote: Collecting Pillow==5.3.0 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 7))
remote: Downloading https://files.pythonhosted.org/packages/62/94/5430ebaa83f91cc7a9f687ff5238e26164a779cca2ef9903232268b0a318/Pillow-5.3.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
remote: Collecting psycopg2==2.7.6.1 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 8))
remote: Downloading https://files.pythonhosted.org/packages/bc/2a/61a8f9719bd6df5b421abd91740cb0595fc3c17b28eaf89fe4f144472ca6/psycopg2-2.7.6.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
remote: Collecting pytz==2018.5 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 9))
remote: Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
remote: Collecting static3==0.7.0 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 10))
remote: Downloading https://files.pythonhosted.org/packages/87/b0/9cf15108b73c4f2ffffe11d237c938f57785f55d3693d822d565432cb680/static3-0.7.0.tar.gz
remote: Collecting whitenoise==4.1.2 (from -r /tmp/build_2786a94b1bb2f663370a40afb339160b/requirements.txt (line 11))
remote: Downloading https://files.pythonhosted.org/packages/fd/2a/b51377ab9826f0551da19951257d2434f46329cd6cfdf9592ea9ca5f6034/whitenoise-4.1.2-py2.py3-none-any.whl
remote: Installing collected packages: dj-database-url, static3, dj-static, pytz, Django, django-multiselectfield, psycopg2, gunicorn, django-toolbelt, Pillow, whitenoise
remote: Running setup.py install for static3: started
remote: Running setup.py install for static3: finished with status 'done'
remote: Running setup.py install for dj-static: started
remote: Running setup.py install for dj-static: finished with status 'done'
remote: Running setup.py install for django-multiselectfield: started
remote: Running setup.py install for django-multiselectfield: finished with status 'done'
remote: Running setup.py install for django-toolbelt: started
remote: Running setup.py install for django-toolbelt: finished with status 'done'
remote: Successfully installed Django-2.0.9 Pillow-5.3.0 dj-database-url-0.5.0 dj-static-0.0.6 django-multiselectfield-0.1.8 django-toolbelt-0.0.1 gunicorn-19.9.0 psycopg2-2.7.6.1 pytz-2018.5 static3-0.7.0 whitenoise-4.1.2
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 15, 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 371, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, 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 288, 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 335, 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 189, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, 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 125, 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 313, in listdir
remote: for entry in os.listdir(path):
remote: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_2786a94b1bb2f663370a40afb339160b/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: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shrouded-springs-78357.
remote:
To https://git.heroku.com/shrouded-springs-78357.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shrouded-springs-78357.git'
I noticed some comments in Stack Over Flow that suggested disabling a heroku parameter:
$ heroku config: set DISABLE_COLLECTSTATIC = 1
In this case the static file was not installed, the push command worked, but when I open the webpage the application is completely unconfigured because it does not recognize the css file among others in the static folder.
I also tried to install the following software:
$ pip install whitenoise
But it also did not work. Below is my file requeriments.txt:
dj-database-url==0.5.0
dj-static==0.0.6
Django==2.0.9
django-multiselectfield==0.1.8
django-toolbelt==0.0.1
gunicorn==19.9.0
Pillow==5.3.0
psycopg2==2.7.6.1
pytz==2018.5
static3==0.7.0
whitenoise==4.1.2
I tried to create the static folder in the project root, but it also did not work, a folder called staticfiles was created including several icons.