0

I was trying to push what i have in my app using Django python to be deployed to Heroku and keep getting this error :

! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/immense-brushlands'

requriment.txt file is there :

asgiref==3.4.1
beautifulsoup4==4.10.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.7
cloudinary==1.26.0
cryptography==35.0.0
defusedxml==0.7.1
Deprecated==1.2.13
dj-database-url==0.5.0
Django==3.2.5
django-bootstrap4==3.0.1
django-braces==1.14.0
django-heroku==0.3.1
django-oauth-toolkit==1.5.0
django-rest-framework-social-oauth2==1.1.0
djangorestframework==3.12.4
gunicorn==20.1.0
idna==3.3
jwcrypto==1.0
oauthlib==3.1.1
psycopg2==2.9.1
pycparser==2.20
PyJWT==2.3.0
python3-openid==3.2.0
pytz==2021.3
requests==2.26.0
requests-oauthlib==1.3.0
six==1.16.0
social-auth-app-django==5.0.0
social-auth-core==4.1.0
soupsieve==2.2.1
sqlparse==0.4.2
stripe==2.59.0
urllib3==1.26.7
whitenoise==5.3.0
wrapt==1.13.2

my Procfile in root directory and contain:

web : gunicorn foodhub.wsgi

I was trying to push what i have in my app using Django python to be deployed to Heroku and keep getting this error : ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/immense-brushlands'`

-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> Python app detected
-----> No Python version was specified. Using the buildpack default: python-3.10.7
       To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.10.7
-----> Installing pip 22.2.2, setuptools 63.4.3 and wheel 0.37.1
-----> Installing SQLite3
-----> Installing requirements with pip
       Collecting asgiref==3.5.2
         Downloading asgiref-3.5.2-py3-none-any.whl (22 kB)
       Collecting certifi==2022.9.24
         Downloading certifi-2022.9.24-py3-none-any.whl (161 kB)
       Collecting cloudinary==1.26.0
         Downloading cloudinary-1.26.0.tar.gz (170 kB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'done'
       Collecting dj-database-url==1.0.0
         Downloading dj_database_url-1.0.0-py3-none-any.whl (6.6 kB)
       Collecting Django==4.1.2
         Downloading Django-4.1.2-py3-none-any.whl (8.1 MB)
       Collecting django-heroku==0.3.1
         Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
       Collecting gunicorn==20.1.0
         Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
       Collecting psycopg2==2.9.4
         Downloading psycopg2-2.9.4.tar.gz (384 kB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'done'
       Collecting six==1.16.0
         Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
       Collecting sqlparse==0.4.3
         Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)
       Collecting tzdata==2022.4
         Downloading tzdata-2022.4-py2.py3-none-any.whl (336 kB)
       Collecting urllib3==1.26.12
         Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
       Collecting whitenoise==6.2.0
         Downloading whitenoise-6.2.0-py3-none-any.whl (19 kB)
       Building wheels for collected packages: cloudinary, psycopg2
         Building wheel for cloudinary (setup.py): started
         Building wheel for cloudinary (setup.py): finished with status 'done'
         Created wheel for cloudinary: filename=cloudinary-1.26.0-py3-none-any.whl size=134187 sha256=391663ac9f9caa29fca028ee944bf59a6ac5066a9aa1012fb188ff52dac36979
         Stored in directory: /tmp/pip-ephem-wheel-cache-odd2a9t_/wheels/58/0d/32/997fc6c26f83c9ae73a1bcd41028973512175982df608523ef
         Building wheel for psycopg2 (setup.py): started
         Building wheel for psycopg2 (setup.py): finished with status 'done'
         Created wheel for psycopg2: filename=psycopg2-2.9.4-cp310-cp310-linux_x86_64.whl size=159965 sha256=cae6fb7d596d71258bdd30d91a0aa6ec5e8d5ba26d5c2c8f9601e00eb569ea53
         Stored in directory: /tmp/pip-ephem-wheel-cache-odd2a9t_/wheels/10/07/ca/a5e7863aeec605e8a19ea9ccc90bb594784c287cc5534bbecb
       Successfully built cloudinary psycopg2
       Installing collected packages: whitenoise, urllib3, tzdata, sqlparse, six, psycopg2, gunicorn, certifi, asgiref, Django, cloudinary, dj-database-url, django-heroku
       Successfully installed Django-4.1.2 asgiref-3.5.2 certifi-2022.9.24 cloudinary-1.26.0 dj-database-url-1.0.0 django-heroku-0.3.1 gunicorn-20.1.0 psycopg2-2.9.4 six-1.16.0 sqlparse-0.4.3 tzdata-2022.4 urllib3-1.26.12 whitenoise-6.2.0
-----> $ python manage.py collectstatic --noinput
       Post-processing 'js/canvas-to-blob.min.js' failed!
       Traceback (most recent call last):
         File "/tmp/build_b3caaaea/manage.py", line 22, in <module>
           main()
         File "/tmp/build_b3caaaea/manage.py", line 18, in main
           execute_from_command_line(sys.argv)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
           utility.execute()
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
           self.fetch_command(subcommand).run_from_argv(self.argv)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
           self.execute(*args, **cmd_options)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
           output = self.handle(*args, **options)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
           collected = self.collect()
         File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 154, in collect
           raise processed
       whitenoise.storage.MissingFileError: The file 'js/canvas-to-blob.min.js.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7ff53e881d50>.
       The JS file 'js/canvas-to-blob.min.js' references a file which could not be found:
         js/canvas-to-blob.min.js.map
       Please check the URL references in this JS file, particularly any
       relative paths which might be pointing to the wrong location.
 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.
       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:
          $ heroku config:set DISABLE_COLLECTSTATIC=1
       https://devcenter.heroku.com/articles/django-assets
****** Collectstatic environment variables:
       PYTHONUNBUFFERED=1
       PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:/app/.heroku/python/lib/pkg-config:
       DEBUG_COLLECTSTATIC=1
       BPLOG_PREFIX=buildpack.python
       PWD=/tmp/build_b3caaaea
       HOME=/app
       LANG=en_US.UTF-8
       SOURCE_VERSION=495ce7e183efedd2df883a898d49dab71e966050
       REQUEST_ID=9bd57211-cb18-3350-055d-aa2d6bfe888e
       ENV_DIR=/tmp/d20221008-54-7rg3a6
       PYTHONPATH=.
       CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
       BIN_DIR=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin
       LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
       SHLVL=1
       LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
       PIP_NO_PYTHON_VERSION_WARNING=1
       BUILDPACK_LOG_FILE=/dev/null
       STACK=heroku-22
       BUILD_DIR=/tmp/build_b3caaaea
       CACHE_DIR=/tmp/codon/tmp/cache
       PATH=/app/.heroku/python/bin:/app/.heroku/vendor/bin::/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/
       EXPORT_PATH=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/../export
       C_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
       DYNO=run.5378
       PROFILE_PATH=/tmp/build_b3caaaea/.profile.d/python.sh
       OLDPWD=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136
       _=/usr/bin/env
 !     Push rejected, failed to compile Python app.
 !     Push failed
remote:        Collecting tzdata==2022.4
remote:          Downloading tzdata-2022.4-py2.py3-none-any.whl (336 kB)
remote:        Collecting urllib3==1.26.12
remote:          Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
remote:        Collecting whitenoise==6.2.0
remote:          Downloading whitenoise-6.2.0-py3-none-any.whl (19 kB)
remote:        Building wheels for collected packages: cloudinary, psycopg2
remote:          Building wheel for cloudinary (setup.py): started
remote:          Building wheel for cloudinary (setup.py): finished with status 'done'
remote:          Created wheel for cloudinary: filename=cloudinary-1.26.0-py3-none-any.whl size=134187 sha256=a8e60aba890ebec526fa450889f89331a3f91deb0951c91ab9e6cbcf4452cf43
remote:          Stored in directory: /tmp/pip-ephem-wheel-cache-nqiyqf0q/wheels/58/0d/32/997fc6c26f83c9ae73a1bcd41028973512175982df608523ef   
remote:          Building wheel for psycopg2 (setup.py): started
remote:          Building wheel for psycopg2 (setup.py): finished with status 'done'
remote:          Created wheel for psycopg2: filename=psycopg2-2.9.4-cp310-cp310-linux_x86_64.whl size=159965 sha256=8087037db2c9ec2fdbae93eb5afd833509bbcbdbd546e980794242a06e01b87a
remote:          Stored in directory: /tmp/pip-ephem-wheel-cache-nqiyqf0q/wheels/10/07/ca/a5e7863aeec605e8a19ea9ccc90bb594784c287cc5534bbecb   
remote:        Successfully built cloudinary psycopg2
remote:        Installing collected packages: whitenoise, urllib3, tzdata, sqlparse, six, psycopg2, gunicorn, certifi, asgiref, Django, cloudinary, dj-database-url, django-heroku
remote:        Successfully installed Django-4.1.2 asgiref-3.5.2 certifi-2022.9.24 cloudinary-1.26.0 dj-database-url-1.0.0 django-heroku-0.3.1 gunicorn-20.1.0 psycopg2-2.9.4 six-1.16.0 sqlparse-0.4.3 tzdata-2022.4 urllib3-1.26.12 whitenoise-6.2.0
remote: -----> $ python manage.py collectstatic --noinput
remote:        Post-processing 'js/load-image.all.min.js' failed!
remote:        Traceback (most recent call last):
remote:          File "/tmp/build_f2d02e58/manage.py", line 22, in <module>
remote:            main()
remote:          File "/tmp/build_f2d02e58/manage.py", line 18, in main
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
remote:            self.fetch_command(subcommand).run_from_argv(self.argv)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
remote:            self.execute(*args, **cmd_options)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
remote:            output = self.handle(*args, **options)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
remote:            collected = self.collect()
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 154, in collect
remote:            raise processed
remote:        whitenoise.storage.MissingFileError: The file 'js/load-image.all.min.js.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7f5b6e77dd50>.
remote:        The JS file 'js/load-image.all.min.js' references a file which could not be found:
remote:          js/load-image.all.min.js.map
remote:        Please check the URL references in this JS file, particularly any
remote:        relative paths which might be pointing to the wrong location.
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:        PYTHONUNBUFFERED=1
remote:        PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:/app/.heroku/python/lib/pkg-config:
remote:        DEBUG_COLLECTSTATIC=1
remote:        BPLOG_PREFIX=buildpack.python
remote:        PWD=/tmp/build_f2d02e58
remote:        HOME=/app
remote:        LANG=en_US.UTF-8
remote:        SOURCE_VERSION=495ce7e183efedd2df883a898d49dab71e966050
remote:        REQUEST_ID=8dbf04e4-d06f-2a07-26fd-fd9f783c0707
remote:        ENV_DIR=/tmp/d20221008-55-86y9b6
remote:        PYTHONPATH=.
remote:        CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
remote:        BIN_DIR=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin
remote:        LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
remote:        SHLVL=1
remote:        LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/python/lib:
remote:        PIP_NO_PYTHON_VERSION_WARNING=1
remote:        BUILDPACK_LOG_FILE=/dev/null
remote:        STACK=heroku-22
remote:        BUILD_DIR=/tmp/build_f2d02e58
remote:        CACHE_DIR=/tmp/codon/tmp/cache
remote:        PATH=/app/.heroku/python/bin:/app/.heroku/vendor/bin::/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/
remote:        EXPORT_PATH=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/../export
remote:        C_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/python/include:
remote:        DYNO=run.5998
remote:        PROFILE_PATH=/tmp/build_f2d02e58/.profile.d/python.sh
remote:        OLDPWD=/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136
remote:        _=/usr/bin/env
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 495ce7e183efedd2df883a898d49dab71e966050
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 495ce7e183efedd2df883a898d49dab71e966050
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote: 
remote: !       Push rejected to immense-brushlands-83439.
remote:
To https://git.heroku.com/immense-brushlands-83439.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/immense-brushlands-83439.git'
mick
  • 13
  • 5
  • 1
    please post the Heroku log – Vi6hal Oct 08 '22 at 16:54
  • hi where can i find it – mick Oct 08 '22 at 16:57
  • 1
    2 ways to find it: 1) when you run git push Heroku, it generates a log in your terminal. 2)You can go to the Heroku dashboard open the application page and look for the release log (should be in the activity tab) – Vi6hal Oct 08 '22 at 17:01
  • 1
    @Noah i just post it – mick Oct 08 '22 at 17:12
  • Note the error message that your Heroku build printed: `whitenoise.storage.MissingFileError: The file 'js/canvas-to-blob.min.js.map' could not be found with .` This is not a Python or Git error (and probably not even django but I left that tag alone): it's just a file you forgot to require or provide or whatever. – torek Oct 08 '22 at 19:52
  • so what should i do – mick Oct 08 '22 at 19:53
  • Find or provide the file. What does the documentation for this "whitenoise" thing, whatever it may be, say about this? – torek Oct 08 '22 at 19:54
  • i don't have any file like this in my directory i only use python and django – mick Oct 08 '22 at 19:58
  • But you have `whitenoise` as a requirement. You're depending on whitenoise. Whitenoise is apparently depending on something else based on some other input you provided to whitenoise. Looks like you may need to do more homework on this. – torek Oct 08 '22 at 20:01
  • but where i can find this whitenoise in my files or directory ? – mick Oct 08 '22 at 20:03
  • Can you check this thread? https://stackoverflow.com/questions/26829435/collectstatic-command-fails-when-whitenoise-is-enabled – Vi6hal Oct 09 '22 at 03:16

0 Answers0