1

I'm beginner and learned how to deploy a Django app to production with this article https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment.

Author of this has django app https://github.com/mdn/django-locallibrary-tutorial that I can push to heroku. I have ~copied/pasted this and added some things https://github.com/Altay02/altai_application1. I can't push my repository to heroku and i can't find different between my and him repo that causes the problem.

I've tried to find solve here Push rejected, failed to compile Python app ,

here Error pushing Django project to Heroku

and other articles, but no result.

this is my console, when i push my repository. error appears

(my_django_environment) C:\Users\123\altai_application1>git push heroku master
Enumerating objects: 179, done.
Counting objects: 100% (179/179), done.
Delta compression using up to 4 threads
Compressing objects: 100% (106/106), done.
Writing objects: 100% (179/179), 62.07 KiB | 2.96 MiB/s, done.
Total 179 (delta 71), reused 151 (delta 55)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     Python has released a security update! Please consider upgrading to python-3.7.3
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.7.4
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to altaisite.
remote:
To https://git.heroku.com/altaisite.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/altaisite.git'

this is my console, when i push original repository. no errors

(my_django_environment) C:\Users\123\django-locallibrary-tutorial>git push heroku master
Enumerating objects: 335, done.
Counting objects: 100% (335/335), done.
Delta compression using up to 4 threads
Compressing objects: 100% (145/145), done.
Writing objects: 100% (335/335), 151.21 KiB | 12.60 MiB/s, done.
Total 335 (delta 181), reused 335 (delta 181)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     Python has released a security update! Please consider upgrading to python-3.7.3
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.7.0
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting dj-database-url==0.5.0 (from -r /tmp/build_785b99783524456d576c234409aaba06/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 Django==2.1.5 (from -r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/36/50/078a42b4e9bedb94efd3e0278c0eb71650ed9672cdc91bd5542953bec17f/Django-2.1.5-py3-none-any.whl (7.3MB)
remote:        Collecting gunicorn==19.9.0 (from -r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote:        Collecting psycopg2-binary==2.7.7 (from -r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 4))
remote:          Downloading https://files.pythonhosted.org/packages/04/c3/fbf0ec416151ce082087bfbb42f236ec42c2c74d2d9f7a5b5cdf49cfc517/psycopg2_binary-2.7.7-cp37-cp37m-manylinux1_x86_64.whl (2.7MB)
remote:        Collecting wheel==0.30.0 (from -r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/0c/80/16a85b47702a1f47a63c104c91abdd0a6704ee8ae3b4ce4afc49bc39f9d9/wheel-0.30.0-py2.py3-none-any.whl (49kB)
remote:        Collecting whitenoise==4.1.2 (from -r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 6))
remote:          Downloading https://files.pythonhosted.org/packages/fd/2a/b51377ab9826f0551da19951257d2434f46329cd6cfdf9592ea9ca5f6034/whitenoise-4.1.2-py2.py3-none-any.whl
remote:        Collecting pytz (from Django==2.1.5->-r /tmp/build_785b99783524456d576c234409aaba06/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/87/76/46d697698a143e05f77bec5a526bf4e56a0be61d63425b68f4ba553b51f2/pytz-2019.2-py2.py3-none-any.whl (508kB)
remote:        Installing collected packages: dj-database-url, pytz, Django, gunicorn, psycopg2-binary, wheel, whitenoise
remote:          Found existing installation: wheel 0.33.6
remote:            Uninstalling wheel-0.33.6:
remote:              Successfully uninstalled wheel-0.33.6
remote:        Successfully installed Django-2.1.5 dj-database-url-0.5.0 gunicorn-19.9.0 psycopg2-binary-2.7.7 pytz-2019.2 wheel-0.30.0 whitenoise-4.1.2
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote:        121 static files copied to '/tmp/build_785b99783524456d576c234409aaba06/staticfiles', 379 post-processed.
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 57.3M
remote: -----> Launching...
remote:        Released v5
remote:        https://mdnaltai.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/mdnaltai.git
 * [new branch]      master -> master

I want push my repository to heroku. Any idea what I'm missing?

sorry for my english, i'm from Russia

  • [This question](https://stackoverflow.com/questions/56677029/heroku-python-app-failing-to-build-when-installing-sqlite3) might help. – Alasdair Aug 27 '19 at 20:26

1 Answers1

3

Looks like your Python version is not working. Try changing the runtime.txt file with python-3.6.8 That worked for me.

rodrinauta
  • 46
  • 1
  • ```runtime.txt``` you mean ```requirements.txt``` or is that a separate file? – Hiwot Mar 09 '21 at 16:28
  • `runtime.txt` is the file that contains the `version of python`. It tells heroku to use which version of python – Lars Sep 05 '21 at 04:42