0

Using Ubuntu 16.04 Going through Python Crash Course chapter 20, I've been using pip3 to install packages instead of pip, and python3 instead of python so that the programs would be interpreted correctly in the terminal, otherwise I would get an error when I try to import a library, because it would otherwise automatically be installed in a python 2.7.1 folder. I've also installed some other modules like wheel so that I wouldn't get an error message installing Django. I had done exactly what it said to do on https://devcenter.heroku.com/articles/heroku-cli to get heroku on my machine. I did this outside the virtual environment, since it didn't work with it on. After I use pip freeze > requirements.txt, this fills up in requirements.txt:

dj-database-url==0.4.2
dj-static==0.0.6
Django==1.11
django-bootstrap3==8.2.3
gunicorn==19.7.1
pkg-resources==0.0.0
psycopg2==2.7.1
python-dateutil==1.5
pytz==2017.2
requests==2.14.1
static3==0.7.0

I've followed every step in the book besides those substitutions. When I run: git push heroku master, I get:

Counting objects: 52, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (52/52), 11.65 KiB | 0 bytes/s, done.
Total 52 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.5.1
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        /app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/bin/steps/pip-install: line 5: /app/.heroku/python/bin/pip: No such file or directory
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to aqueous-tor-99755.
remote: 
To https://git.heroku.com/aqueous-tor-99755.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/aqueous-tor-99755.git'

I've tried using heroku config:unset BUILDPACK_URL. I updated pip in the virtual environment. In my runtime.txt I have python-3.5.1 which is not supported under https://devcenter.heroku.com/articles/python-runtimes#supported-python-runtimes, but the book recommends using your own unless you get an error, I changed the runtime to python-3.6.1 and I get this error:

    Counting objects: 55, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (46/46), done.
    Writing objects: 100% (55/55), 11.88 KiB | 0 bytes/s, done.
    Total 55 (delta 8), 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 dj-database-url==0.4.2 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 1))
    remote:          Downloading dj_database_url-0.4.2-py2.py3-none-any.whl
    remote:        Collecting dj-static==0.0.6 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 2))
    remote:          Downloading dj-static-0.0.6.tar.gz
    remote:        Collecting Django==1.11 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 3))
    remote:          Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
    remote:        Collecting django-bootstrap3==8.2.3 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 4))
    remote:          Downloading django-bootstrap3-8.2.3.tar.gz
    remote:        Collecting gunicorn==19.7.1 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 5))
    remote:          Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
    remote:        Collecting pkg-resources==0.0.0 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 6))
    remote:          Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 6)) (from versions: )
    remote:        No matching distribution found for pkg-resources==0.0.0 (from -r /tmp/build_7678757494d3fb6fbccafe9175845e3d/requirements.txt (line 6))
    remote:  !     Push rejected, failed to compile Python app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy...
    remote: 
    remote: !   Push rejected to aqueous-tor-99755.
    remote: 
    To https://git.heroku.com/aqueous-tor-99755.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/aqueous-tor-99755.git'

I then delete pkg-resources==0.0.0 from requirements.txt, commit, and push again and then I get this error:

Counting objects: 58, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (58/58), 12.11 KiB | 0 bytes/s, done.
Total 58 (delta 10), 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 dj-database-url==0.4.2 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 1))
remote:          Downloading dj_database_url-0.4.2-py2.py3-none-any.whl
remote:        Collecting dj-static==0.0.6 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 2))
remote:          Downloading dj-static-0.0.6.tar.gz
remote:        Collecting Django==1.11 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 3))
remote:          Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
remote:        Collecting django-bootstrap3==8.2.3 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 4))
remote:          Downloading django-bootstrap3-8.2.3.tar.gz
remote:        Collecting gunicorn==19.7.1 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 5))
remote:          Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
remote:        Collecting psycopg2==2.7.1 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 6))
remote:          Downloading psycopg2-2.7.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
remote:        Collecting python-dateutil==1.5 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 7))
remote:          Downloading python-dateutil-1.5.tar.gz (233kB)
remote:        Collecting pytz==2017.2 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 8))
remote:          Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
remote:        Collecting requests==2.14.1 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 9))
remote:          Downloading requests-2.14.1-py2.py3-none-any.whl (559kB)
remote:        Collecting static3==0.7.0 (from -r /tmp/build_40a35fb4afde2e3f07504565db1217e6/requirements.txt (line 10))
remote:          Downloading static3-0.7.0.tar.gz
remote:        Installing collected packages: dj-database-url, static3, dj-static, pytz, Django, django-bootstrap3, gunicorn, psycopg2, python-dateutil, requests
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-bootstrap3: started
remote:            Running setup.py install for django-bootstrap3: finished with status 'done'
remote:          Running setup.py install for python-dateutil: started
remote:            Running setup.py install for python-dateutil: finished with status 'done'
remote:        Successfully installed Django-1.11 dj-database-url-0.4.2 dj-static-0.0.6 django-bootstrap3-8.2.3 gunicorn-19.7.1 psycopg2-2.7.1 python-dateutil-1.5 pytz-2017.2 requests-2.14.1 static3-0.7.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 124, in collect
remote:            handler(path, prefixed_path, storage)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 354, in copy_file
remote:            if not self.delete_file(path, prefixed_path, source_storage):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 260, in delete_file
remote:            if self.storage.exists(prefixed_path):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 392, in exists
remote:            return os.path.exists(self.path(name))
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 50, in path
remote:            raise ImproperlyConfigured("You're using the staticfiles app "
remote:        django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
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 aqueous-tor-99755.
remote: 
To https://git.heroku.com/aqueous-tor-99755.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/aqueous-tor-99755.git'

STATIC_ROOT = 'staticfiles' is in my settings.py and I have the folder named static with placeholder.txt inside like it had said to do in the book if the static folder is related to this issue, but I don't have any other leads.

  • @e4c5 I had it activated, followed every step to the best of my knowledge. Only time I disabled it was when installing heroku. Enabled it again after installing. – itachi476 May 10 '17 at 07:30
  • @ec45 I also did all the heroku stuff again using the project that started in ch 19 during the first exercise and I got the same error message. Trying again using pycharm this time to keep track of the project, was using geany before. I'm hoping that pycharm will do a little better, but I feel like the ide has nothing to do with it. .gitignore ignores __pycache__/ ll_env (the virtual environment folder) and *.sqlite3 and I wouldn't think that geany especially would do anything to the other files. So it probably has to do with heroku, since pip & pip3 were the same & python & python3 in venv – itachi476 May 10 '17 at 07:41
  • Are you still having this issue? If so, I'm happy to try to help. – japhyr Jun 16 '17 at 23:57

0 Answers0