I'm trying to deploy on heroku, which is seeming to be the most complicated I've dealt with since programming. I'm getting an error that I don't have a Procfile and I do. It's only named Procfile. Not ProcFile or Procfile.txt. After I run
git push heroku master
I get the following error
Counting objects: 8524, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7522/7522), done.
Writing objects: 100% (8524/8524), 14.00 MiB | 2.67 MiB/s, done.
Total 8524 (delta 2214), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Warning: Your application is missing a Procfile. This file tells Heroku how to run your application.
remote: ! Learn more: https://devcenter.heroku.com/articles/procfile
remote: -----> Installing python-2.7.11
remote: $ pip install -r requirements.txt
remote: Collecting beautifulsoup4==4.4.1 (from -r requirements.txt (line 1))
remote: Downloading beautifulsoup4-4.4.1-py2-none-any.whl (81kB)
remote: Collecting dj-database-url==0.4.0 (from -r requirements.txt (line 2))
remote: Downloading dj-database-url-0.4.0.tar.gz
remote: Collecting dj-static==0.0.6 (from -r requirements.txt (line 3))
remote: Downloading dj-static-0.0.6.tar.gz
remote: Collecting Django==1.9.4 (from -r requirements.txt (line 4))
remote: Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
remote: Collecting django-crispy-forms==1.6.0 (from -r requirements.txt (line 5))
remote: Downloading django_crispy_forms-1.6.0-py2-none-any.whl (178kB)
remote: Collecting django-haystack==2.4.1 (from -r requirements.txt (line 6))
remote: Downloading django_haystack-2.4.1-py2-none-any.whl (95kB)
remote: Collecting django-taggit==0.18.0 (from -r requirements.txt (line 7))
remote: Downloading django_taggit-0.18.0-py2.py3-none-any.whl
remote: Collecting django-toolbelt==0.0.1 (from -r requirements.txt (line 8))
remote: Downloading django-toolbelt-0.0.1.tar.gz
remote: Collecting gunicorn==19.4.5 (from -r requirements.txt (line 9))
remote: Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
remote: Collecting Pillow==3.1.1 (from -r requirements.txt (line 10))
remote: Downloading Pillow-3.1.1.tar.gz (10.1MB)
remote: Collecting psycopg2==2.6.1 (from -r requirements.txt (line 11))
remote: Downloading psycopg2-2.6.1.tar.gz (371kB)
remote: Collecting pysolr==3.4.0 (from -r requirements.txt (line 12))
remote: Downloading pysolr-3.4.0-py2.py3-none-any.whl
remote: Collecting pytz==2016.1 (from -r requirements.txt (line 13))
remote: Downloading pytz-2016.1-py2.py3-none-any.whl (476kB)
remote: Collecting requests==2.9.1 (from -r requirements.txt (line 14))
remote: Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
remote: Collecting static3==0.6.1 (from -r requirements.txt (line 15))
remote: Downloading static3-0.6.1.tar.gz
remote: Collecting whitenoise==3.0 (from -r requirements.txt (line 16))
remote: Downloading whitenoise-3.0-py2.py3-none-any.whl
remote: Installing collected packages: beautifulsoup4, dj-database-url, static3, dj-static, Django, django-crispy-forms, django-haystack, django-taggit, psycopg2, gunicorn, django-toolbelt, Pillow, requests, pysolr, pytz, whitenoise
remote: Running setup.py install for dj-database-url: started
remote: Running setup.py install for dj-database-url: finished with status 'done'
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 psycopg2: started
remote: Running setup.py install for psycopg2: 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: Running setup.py install for Pillow: started
remote: Running setup.py install for Pillow: finished with status 'done'
remote: Successfully installed Django-1.9.4 Pillow-3.1.1 beautifulsoup4-4.4.1 dj-database-url-0.4.0 dj-static-0.0.6 django-crispy-forms-1.6.0 django-haystack-2.4.1 django-taggit-0.18.0 django-toolbelt-0.0.1 gunicorn-19.4.5 psycopg2-2.6.1 pysolr-3.4.0 pytz-2016.1 requests-2.9.1 static3-0.6.1 whitenoise-3.0
remote:
remote: $ python mysite/manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "mysite/manage.py", line 10, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
remote: self.execute(*args, **cmd_options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
remote: output = self.handle(*args, **options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
remote: for path, storage in finder.list(self.ignore_patterns):
remote: File "/app/.heroku/python/lib/python2.7/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/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
remote: directories, files = storage.listdir(location)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 299, in listdir
remote: for entry in os.listdir(path):
remote: OSError: [Errno 2] No such file or directory: '/app/mysite/mysite/static'
remote:
remote: ! Error while running '$ python mysite/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: ! Push rejected, failed to compile Python app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to alt-vera.
I don't know what the issue is. I've googled and none of the solutions seem to work. Also, Locally i'm using python 3.5 But In the error message I am seeing
Installing python-2.7.11 Why is that. Could this be part of the error
EDIT this is my Procfile
web: gunicorn mysite.wsgi:application --log-file -
EDIT: It worked after me doing the same thing over and over
But now I'm getting a different error message
OSError: [Errno 2] No such file or directory: '/app/mysite/mysite/static'
remote:
remote: ! Error while running '$ python mysite/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: ! Push rejected, failed to compile Python app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to alt-vera.
remote:
To https://git.heroku.com/alt-vera.git
your application is missing the procfile add it and then try.
for help https://devcenter.heroku.com/articles/procfile
example for Procfile
web:python manage.py runserver
web: gunicorn your-app-name.wsgi --log-file -
heroku ps:scale web=1
Coming to this rather late, so not sure if this will be helpful. I found your question because I was having the same problem: I used the Heroku-supplied Django template and definitely had a Procfile in the root of the project.
Which folder did you do $ git init in?
My mistake was that I had created a folder ('WEB_CODE') on my desktop to hold this project and initialized THIS folder as a git repo. This meant that the Django app was being installed in a sub-folder at WEB_CODE/myapp, so the Procfile was at the root of myapp, which was not the head of the git repo.
I scrapped this and started over. I now have a new folder to hold everything (suppose it's called 'APP_CODE'), and once I installed the Heroku-supplied Django app, I made the subdirectory which was created from this installation the head of the git repo (eg: APP_CODE/myapp is the repo, not APP_CODE). Consequently, the Procfile was then in the root of the project.
I committed the changes, pushed to my personal github, and then I re-tried the $heroku create and $ git push heroku master commands and they worked like a charm.
Sorry if Late but i discovered it lately after 2 hours googling to find an answer
The PROBLEM was that i renamed the file "procfile" with lowercase p. So I renamed it to "Procfile" with Uppercase P. then i recreated the git repo then added them to stage then committed them. after that i pushed my branch in my case "master" to heroku and it worked fine for me.
I'm just saying it in case any one got stucked in the same error.
I had this frustrating problem, but I finally got my procfile to work. 1st make sure that you name it "Procfile" without a ".exe" or ".txt" or ".bat". Just "Procfile". For Django I included the following each in it's own line inside the Procfile:
web:python manage.py runserver
web: gunicorn app-name.wsgi
heroku ps:scale web=1
Then even if you have done this before, you need to use cmd to cd into the file where your project is and enter the following commands and hit after each command:
pip freeze > requirements.txt
git init
git add .
git status
git commit -m "Initial Commit"
git push heroku master
heroku open
This is what worked for me.
I've just had this problem, create the Procfile with the command, not by renaming a created-file:
echo web:..etc>Procfile (without spaces)
Related
I am deploying a web app made in Django on Heroku.
I am following a tutorial in which tutor has made a w/s without any CSS / Image input from User. But my app has lot of style and profile pics etc which need ImageField in model.
IMP -> I made the project for Django 2.2, but django 3 got launched so I am using that.
Please help me...
I have done following steps:
Installed Anaconda
Made Virtual Env & Activated it.
Installed pip
Installed Dependencies
pip freeze > requirements.txt
git add . & git push -am "Text"
git push heroku master
My requirements.txt :
asgiref==3.2.3
certifi==2019.11.28
cffi==1.13.2
decouple==0.0.7
dj-database-url==0.5.0
Django==3.0.2
django-appconf==1.0.3
django-bootstrap3==12.0.3
django-heroku==0.3.1
django-mediumeditor==1.0.0
gunicorn==20.0.4
misaka==2.1.1
psycopg2==2.8.4
pycparser==2.19
python-decouple==3.3
pytz==2019.3
six==1.14.0
sqlparse==0.3.0
whitenoise==5.0.1
My Error:
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 8 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 1.96 KiB | 1.96 MiB/s, done.
Total 16 (delta 9), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Need to update SQLite3, clearing cache
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: Sqlite3 successfully installed.
remote: -----> Installing requirements with pip
remote: Collecting asgiref==3.2.3 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/a5/cb/5a235b605a9753ebcb2730c75e610fb51c8cab3f01230080a8229fa36adb/asgiref-3.2.3-py2.py3-none-any.whl
remote: Collecting certifi==2019.11.28 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
remote: Collecting cffi==1.13.2 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/49/72/0d42f94fe94afa8030350c26e9d787219f3f008ec9bf6b86c66532b29236/cffi-1.13.2-cp36-cp36m-manylinux1_x86_64.whl (397kB)
remote: Collecting decouple==0.0.7 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 4))
remote: Could not find a version that satisfies the requirement decouple==0.0.7 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 4)) (from versions: )
remote: No matching distribution found for decouple==0.0.7 (from -r /tmp/build_4f35d204f58c179bdbd37fc71a4afa61/requirements.txt (line 4))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to *******.
remote:
To https://git.heroku.com/******.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/******.git'
You will want to add a runtime.txt file at the root of your project with content:
python-3.7.2
And then push again.
You use Python 3.6, decouple requires Python 3.7+.
Whenever I type command: git push heroku master
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 4 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (32/32), 11.43 KiB | 557.00 KiB/s, done.
Total 32 (delta 2), 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_731c5da72f871fc9827c03c3e6dfa9eb/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.3 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/d1/e5/2676be45ea49cfd09a663f289376b3888accd57ff06c953297bfdee1fb08/Django-2.1.3-py3-none-any.whl (7.3MB)
remote: Collecting django-heroku==0.3.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
remote: Collecting gunicorn==19.9.0 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 4))
remote: Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote: Collecting psycopg2==2.7.6.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 5))
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.7 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 6))
remote: Downloading https://files.pythonhosted.org/packages/f8/0e/2365ddc010afb3d79147f1dd544e5ee24bf4ece58ab99b16fbb465ce6dc0/pytz-2018.7-py2.py3-none-any.whl (506kB)
remote: Collecting whitenoise==4.1.2 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 7))
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, pytz, Django, whitenoise, psycopg2, django-heroku, gunicorn
remote: Successfully installed Django-2.1.3 dj-database-url-0.5.0 django-heroku-0.3.1 gunicorn-19.9.0 psycopg2-2.7.6.1 pytz-2018.7 whitenoise-4.1.2
it give error here
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 381, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, 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 316, 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 353, 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 188, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, 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 343, 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 249, 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 308, 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 43, 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 arshergon.
remote:
To https://git.heroku.com/arshergon.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/arshergon.git'
python version : 3.6.7
django version : 2.1.3
heroku version : 0.1.4
git version : 2.20.1.windows.1
machine : window 10
I have no staticfiles it is a simple Hello, World app
the command I type:
git init
git --all
git commit -m "first commit"
git: remote -a websitename
git push heroku master
try this
heroku config:set DISABLE_COLLECTSTATIC=1
Before: When error's happening
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 23, 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 316, in listdir
remote: for entry in os.scandir(path):
remote: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'
As we can observe, the traceback states
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'.
This is because I had my static file # root/home/static, while my STATICFILES_DIR is not pointing to that dir. So only thing I did is
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "home", "static"),
]
instead of usual os.path.join(BASE_DIR, "static").
And if you're just trying without any static files, you can directly use heroku config:set DISABLE_COLLECTSTATIC=1 and then push.
Even though you don't have static files, a Django Hello World app does mention them.
Do check if you can declare STATIC_ROOT your settings.py:
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
(as it is done in here)
I want to deploy a python app on Heroku, i have tried pip install python3_xlib and pip install --upgrade setuptools, but still, I can't fix the error:
(ll_env) C:\Users\lyj\Desktop\Python_journey_code\learning_log>git push heroku master
Counting objects: 49, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (49/49), 11.77 KiB | 388.00 KiB/s, done.
Total 49 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.5, which is unsupported).
remote: ! We recommend upgrading by specifying the latest version (python-3.6.6).
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.6.5
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting bottle==0.12.13 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/bd/99/04dc59ced52a8261ee0f965a8968717a255ea84a36013e527944dbf3468c/bottle-0.12.13.tar.gz (70kB)
remote: Collecting certifi==2018.4.16 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
remote: Collecting chardet==3.0.4 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
remote: Collecting cycler==0.10.0 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 4))
.......
remote: Collecting matplotlib==2.2.2 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 11))
remote: Downloading https://files.pythonhosted.org/packages/49/b8/89dbd27f2fb171ce753bb56220d4d4f6dbc5fe32b95d8edc4415782ef07f/matplotlib-2.2.2-cp36-cp36m-manylinux1_x86_64.whl (12.6MB)
remote: Collecting numpy==1.14.2 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 12))
remote: Downloading https://files.pythonhosted.org/packages/6e/dc/92c0f670e7b986829fc92c4c0208edb9d72908149da38ecda50d816ea057/numpy-1.14.2-cp36-cp36m-manylinux1_x86_64.whl (12.2MB)
remote: Collecting Pillow==5.1.0 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 13))
remote: Downloading https://files.pythonhosted.org/packages/5f/4b/8b54ab9d37b93998c81b364557dff9f61972c0f650efa0ceaf470b392740/Pillow-5.1.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
remote: Collecting PyAutoGUI==0.9.36 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 14))
remote: Downloading https://files.pythonhosted.org/packages/2e/83/89b5adbc37d1bbf7b486a2c1c00e8037e6f801e8c053c4897bb82d9510c6/PyAutoGUI-0.9.36.tar.gz (46kB)
remote: Complete output from command python setup.py egg_info:
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/setup.py", line 6, in <module>
remote: version=__import__('pyautogui').__version__,
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/pyautogui/__init__.py", line 115, in <module>
remote: from . import _pyautogui_x11 as platformModule
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/pyautogui/_pyautogui_x11.py", line 7, in <module>
remote: from Xlib.display import Display
remote: ModuleNotFoundError: No module named 'Xlib'
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dljfbbwj/PyAutoGUI/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-basin-12135.
remote:
To https://git.heroku.com/shielded-basin-12135.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-basin-12135.git'
For python3 try -
pip install python3-xlib
First question on stackoverflow :D (because I found almost everything until now).
I try to deploy my python app to Heroku, but the following error appears:
git push heroku master
Counting objects: 7036, done.
Compressing objects: 100% (3933/3933), done.
Writing objects: 100% (7036/7036), 10.97 MiB | 338.00 KiB/s, done.
Total 7036 (delta 2020), reused 7021 (delta 2014)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.2
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: Collecting aniso8601==1.2.1 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 1))
remote: Downloading aniso8601-1.2.1.tar.gz (62kB)
remote: Collecting click==6.7 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 2))
remote: Downloading click-6.7-py2.py3-none-any.whl (71kB)
remote: Collecting cycler==0.10.0 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 3))
remote: Downloading cycler-0.10.0-py2.py3-none-any.whl
remote: Collecting deap==1.0.2.post2 (from -r
remote: Collecting Flask==0.12.2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 5))
remote: Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
remote: Collecting Flask-RESTful==0.3.6 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 6))
remote: Downloading Flask_RESTful-0.3.6-py2.py3-none-any.whl
remote: Collecting functools32==3.2.3.post2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 7))
remote: Downloading functools32-3.2.3-2.zip
remote: Complete output from command python setup.py egg_info:
remote: This backport is for Python 2.7 only.
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l0v0636d/functools32/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to XXXXXXX (servername by Heroku).
remote:
On my virtual box everything works fine if I do
pip install -r requirements.txt
I tried the following with no avail:
changing functools32 version
Removing functools from requirements text, which made me realize it is a dependency by Flask for decorators :(
Answer (thanks to the comments):
I didn't realize that I used python 2.7 (again, I am a beginner) in my virtualenv. Seems that using then the functools somewhere automatically installed the functools32 package which ports the functools from python 3 to 2. Heroku is using python 3 by default, so that is why functools32 is probably not available.
I now installed a python 3 virtual environment thanks to this post, ported the few things I hat to port from 2 to 3 and everything works like a charm.
Thanks to davidism & dimmg to point me into the right direction.
I'm trying to deploy a basic Django app to Heroku, but am getting an error when I try to deploy.
It looks like the error is with whitenoise. I have six installed as part of my requirements so it should handle urllib.parse.
Here is the error:
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 290, in get_storage_class
remote: raise ImproperlyConfigured('Error importing storage module %s: "%s"' % (module, e))
remote: django.core.exceptions.ImproperlyConfigured: Error importing storage module whitenoise.django: "No module named urllib.parse"
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
Here is the full stack:
remote:
remote: -----> Python app detected
remote: -----> Uninstalling stale dependencies
remote: Uninstalling DateTime-4.1.1:
remote: Successfully uninstalled DateTime-4.1.1
remote: Uninstalling simplejson-3.8.2:
remote: Successfully uninstalled simplejson-3.8.2
remote: -----> Noticed cffi. Bootstrapping libffi.
remote: $ pip install -r requirements.txt
remote: Collecting altgraph==0.10.2 (from -r requirements.txt (line 1))
remote: Downloading altgraph-0.10.2.tar.gz (481kB)
remote: Collecting bdist-mpkg==0.5.0 (from -r requirements.txt (line 2))
remote: Downloading bdist_mpkg-0.5.0.tar.gz
remote: Collecting bpython==0.12 (from -r requirements.txt (line 3))
remote: Downloading bpython-0.12.tar.gz (130kB)
remote: Collecting csvkit==0.7.3 (from -r requirements.txt (line 4))
remote: Downloading csvkit-0.7.3.tar.gz
remote: Collecting Cython==0.19.2 (from -r requirements.txt (line 5))
remote: Downloading Cython-0.19.2-cp27-cp27m-manylinux1_x86_64.whl (4.0MB)
remote: Collecting dbf==0.94.3 (from -r requirements.txt (line 6))
remote: Downloading dbf-0.94.003.tar.gz (79kB)
remote: Collecting dj-database-url==0.4.1 (from -r requirements.txt (line 7))
remote: Downloading dj-database-url-0.4.1.tar.gz
remote: Collecting Django==1.5.4 (from -r requirements.txt (line 8))
remote: Downloading Django-1.5.4.tar.gz (8.1MB)
remote: Collecting future==0.11.2 (from -r requirements.txt (line 9))
remote: Downloading future-0.11.2.tar.gz (321kB)
remote: Collecting futures==3.0.5 (from -r requirements.txt (line 10))
remote: Downloading futures-3.0.5-py2-none-any.whl
remote: Collecting greenlet==0.4.1 (from -r requirements.txt (line 11))
remote: Downloading greenlet-0.4.1.zip (75kB)
remote: Collecting grequests==0.2.0 (from -r requirements.txt (line 12))
remote: Downloading grequests-0.2.0.tar.gz
remote: Collecting gunicorn==19.6.0 (from -r requirements.txt (line 13))
remote: Downloading gunicorn-19.6.0-py2.py3-none-any.whl (114kB)
remote: Collecting humanize==0.5 (from -r requirements.txt (line 14))
remote: Downloading humanize-0.5.tar.gz
remote: Collecting iso8601==0.1.8 (from -r requirements.txt (line 15))
remote: Downloading iso8601-0.1.8.tar.gz
remote: Collecting livestreamer==1.12.2 (from -r requirements.txt (line 16))
remote: Downloading livestreamer-1.12.2.tar.gz (430kB)
remote: Collecting macholib==1.5.1 (from -r requirements.txt (line 17))
remote: Downloading macholib-1.5.1.tar.gz (454kB)
remote: Collecting modulegraph==0.10.4 (from -r requirements.txt (line 18))
remote: Downloading modulegraph-0.10.4.tar.gz (532kB)
remote: Collecting MySQL-python==1.2.4 (from -r requirements.txt (line 19))
remote: Downloading MySQL-python-1.2.4.zip (113kB)
remote: Collecting openpyxl==2.0.3 (from -r requirements.txt (line 20))
remote: Downloading openpyxl-2.0.3.tar.gz (113kB)
remote: Collecting py2app==0.7.3 (from -r requirements.txt (line 21))
remote: Downloading py2app-0.7.3.tar.gz (1.2MB)
remote: Collecting pycrypto==2.6.1 (from -r requirements.txt (line 22))
remote: Downloading pycrypto-2.6.1.tar.gz (446kB)
remote: Collecting pycurl==7.19.0.2 (from -r requirements.txt (line 23))
remote: Downloading pycurl-7.19.0.2.tar.gz (89kB)
remote: Collecting Pygments==1.6 (from -r requirements.txt (line 24))
remote: Downloading Pygments-1.6.tar.gz (1.4MB)
remote: Collecting pyOpenSSL==0.13.1 (from -r requirements.txt (line 25))
remote: Downloading pyOpenSSL-0.13.1.tar.gz (254kB)
remote: Collecting pyparsing==2.0.1 (from -r requirements.txt (line 26))
remote: Downloading pyparsing-2.0.1.tar.gz (1.1MB)
remote: Collecting python-dateutil==1.5 (from -r requirements.txt (line 27))
remote: Downloading python-dateutil-1.5.tar.gz (233kB)
remote: Collecting pytz==2013.7 (from -r requirements.txt (line 28))
remote: Downloading pytz-2013.7.tar.bz2 (177kB)
remote: Collecting requests==2.0.1 (from -r requirements.txt (line 29))
remote: Downloading requests-2.0.1-py2.py3-none-any.whl (439kB)
remote: Collecting singledispatch==3.4.0.3 (from -r requirements.txt (line 30))
remote: Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
remote: Collecting six==1.4.1 (from -r requirements.txt (line 31))
remote: Downloading six-1.4.1.tar.gz
remote: Collecting SQLAlchemy==0.9.4 (from -r requirements.txt (line 32))
remote: Downloading SQLAlchemy-0.9.4.tar.gz (4.5MB)
remote: Collecting virtualenv==15.0.3 (from -r requirements.txt (line 33))
remote: Downloading virtualenv-15.0.3-py2.py3-none-any.whl (3.5MB)
remote: Collecting whitenoise==3.2.2 (from -r requirements.txt (line 34))
remote: Downloading whitenoise-3.2.2-py2.py3-none-any.whl
remote: Collecting xattr==0.6.4 (from -r requirements.txt (line 35))
remote: Downloading xattr-0.6.4.tar.gz
remote: Collecting xlrd==0.9.3 (from -r requirements.txt (line 36))
remote: Downloading xlrd-0.9.3.tar.gz (178kB)
remote: Collecting zope.interface==4.1.1 (from -r requirements.txt (line 37))
remote: Downloading zope.interface-4.1.1.tar.gz (864kB)
remote: Collecting gevent (from grequests==0.2.0->-r requirements.txt (line 12))
remote: Downloading gevent-1.1.2-cp27-cp27m-manylinux1_x86_64.whl (1.3MB)
remote: Collecting jdcal (from openpyxl==2.0.3->-r requirements.txt (line 20))
remote: Downloading jdcal-1.3.tar.gz
remote: Installing collected packages: altgraph, bdist-mpkg, Pygments, bpython, xlrd, python-dateutil, SQLAlchemy, jdcal, openpyxl, dbf, csvkit, Cython, dj-database-url, Django, future, futures, greenlet, gevent, requests, grequests, gunicorn, humanize, iso8601, six, singledispatch, livestreamer, macholib, modulegraph, MySQL-python, py2app, pycrypto, pycurl, pyOpenSSL, pyparsing, pytz, virtualenv, whitenoise, xattr, zope.interface
remote: Running setup.py install for altgraph: started
remote: Running setup.py install for altgraph: finished with status 'done'
remote: Running setup.py install for bdist-mpkg: started
remote: Running setup.py install for bdist-mpkg: finished with status 'done'
remote: Running setup.py install for Pygments: started
remote: Running setup.py install for Pygments: finished with status 'done'
remote: Running setup.py install for bpython: started
remote: Running setup.py install for bpython: finished with status 'done'
remote: Running setup.py install for xlrd: started
remote: Running setup.py install for xlrd: 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: Running setup.py install for SQLAlchemy: started
remote: Running setup.py install for SQLAlchemy: finished with status 'done'
remote: Running setup.py install for jdcal: started
remote: Running setup.py install for jdcal: finished with status 'done'
remote: Running setup.py install for openpyxl: started
remote: Running setup.py install for openpyxl: finished with status 'done'
remote: Running setup.py install for dbf: started
remote: Running setup.py install for dbf: finished with status 'done'
remote: Running setup.py install for csvkit: started
remote: Running setup.py install for csvkit: finished with status 'done'
remote: Running setup.py install for dj-database-url: started
remote: Running setup.py install for dj-database-url: finished with status 'done'
remote: Running setup.py install for Django: started
remote: Running setup.py install for Django: finished with status 'done'
remote: Running setup.py install for future: started
remote: Running setup.py install for future: finished with status 'done'
remote: Running setup.py install for greenlet: started
remote: Running setup.py install for greenlet: finished with status 'done'
remote: Found existing installation: requests 2.11.1
remote: Uninstalling requests-2.11.1:
remote: Successfully uninstalled requests-2.11.1
remote: Running setup.py install for grequests: started
remote: Running setup.py install for grequests: finished with status 'done'
remote: Running setup.py install for humanize: started
remote: Running setup.py install for humanize: finished with status 'done'
remote: Running setup.py install for iso8601: started
remote: Running setup.py install for iso8601: finished with status 'done'
remote: Running setup.py install for six: started
remote: Running setup.py install for six: finished with status 'done'
remote: Running setup.py install for livestreamer: started
remote: Running setup.py install for livestreamer: finished with status 'done'
remote: Running setup.py install for macholib: started
remote: Running setup.py install for macholib: finished with status 'done'
remote: Running setup.py install for modulegraph: started
remote: Running setup.py install for modulegraph: finished with status 'done'
remote: Running setup.py install for MySQL-python: started
remote: Running setup.py install for MySQL-python: finished with status 'done'
remote: Running setup.py install for py2app: started
remote: Running setup.py install for py2app: finished with status 'done'
remote: Running setup.py install for pycrypto: started
remote: Running setup.py install for pycrypto: finished with status 'done'
remote: Running setup.py install for pycurl: started
remote: Running setup.py install for pycurl: finished with status 'done'
remote: Running setup.py install for pyOpenSSL: started
remote: Running setup.py install for pyOpenSSL: finished with status 'done'
remote: Running setup.py install for pyparsing: started
remote: Running setup.py install for pyparsing: finished with status 'done'
remote: Found existing installation: pytz 2016.7
remote: Uninstalling pytz-2016.7:
remote: Successfully uninstalled pytz-2016.7
remote: Running setup.py install for pytz: started
remote: Running setup.py install for pytz: finished with status 'done'
remote: Running setup.py install for xattr: started
remote: Running setup.py install for xattr: finished with status 'done'
remote: Found existing installation: zope.interface 4.3.2
remote: Uninstalling zope.interface-4.3.2:
remote: Successfully uninstalled zope.interface-4.3.2
remote: Running setup.py install for zope.interface: started
remote: Running setup.py install for zope.interface: finished with status 'done'
remote: Successfully installed Cython-0.19.2 Django-1.5.4 MySQL-python-1.2.4 Pygments-1.6 SQLAlchemy-0.9.4 altgraph-0.10.2 bdist-mpkg-0.5.0 bpython-0.12 csvkit-0.7.3 dbf-0.94.3 dj-database-url-0.4.1 future-0.11.2 futures-3.0.5 gevent-1.1.2 greenlet-0.4.1 grequests-0.2.0 gunicorn-19.6.0 humanize-0.5 iso8601-0.1.8 jdcal-1.3 livestreamer-1.12.2 macholib-1.5.1 modulegraph-0.10.4 openpyxl-2.0.3 py2app-0.7.3 pyOpenSSL-0.13.1 pycrypto-2.6.1 pycurl-7.19.0.2 pyparsing-2.0.1 python-dateutil-1.5 pytz-2013.7 requests-2.0.1 singledispatch-3.4.0.3 six-1.4.1 virtualenv-15.0.3 whitenoise-3.2.2 xattr-0.6.4 xlrd-0.9.3 zope.interface-4.1.1
remote:
remote: $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 10, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
remote: klass = load_command_class(app_name, subcommand)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 78, in load_command_class
remote: return module.Command()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 58, in __init__
remote: self.storage.path('')
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/functional.py", line 204, in inner
remote: self._setup()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 307, in _setup
remote: self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 290, in get_storage_class
remote: raise ImproperlyConfigured('Error importing storage module %s: "%s"' % (module, e))
remote: django.core.exceptions.ImproperlyConfigured: Error importing storage module whitenoise.django: "No module named urllib.parse"
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.
You're using an unsupported version of Django. Django 1.5 has been out of mainstream support for three years, and out of extended support for two.
See here: https://www.djangoproject.com/download/#supported-versions
The latest version of WhiteNoise is tested with Django 1.8 and up.