2016-03-30 4 views
2

enter image description here Ich versuche, auf Heroku zu implementieren, das scheint das komplizierteste zu sein, mit dem ich seit der Programmierung fertig bin. Ich bekomme einen Fehler, dass ich kein Procfile habe und ich auch. Es heißt nur Procfile. Nicht ProcFile oder Procfile.txt. Nachdem ichVersuch, auf Heroku zu verteilen, aber immer wieder zurückgewiesen zu werden

git push heroku master 

laufen bekomme ich folgende Fehler

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. 

Ich weiß nicht, was das Problem ist. Ich habe gegoogelt und keine der Lösungen scheint zu funktionieren. Auch lokal bin ich mit Python 3.5 Aber in der Fehlermeldung Ich sehe

Installing python-2.7.11 Why is that. Could this be part of the error 

EDIT dies ist mein procfile

web: gunicorn mysite.wsgi:application --log-file - 

EDIT: Es ist nach mir gearbeitet, um die gleiche Sache immer und immer

enter image description here

Aber jetzt erhalte ich eine andere Fehlermeldung

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 
+0

versuchen u statische Vermögenswerte zu sammeln? – levi

+0

danke für die Antwort. Ich versuche nur nach den Anweisungen zu implementieren – losee

+0

Sie müssen ein Profil erstellen (rufen Sie es 'Profil') und dann ** fügen Sie es zu Ihrem Repository ** mit' git add Procfile', dann ** bestätigen Sie Ihre Änderungen ** mit 'git commit -m" hinzufügen procfile "' dann endlich, 'git push heroku master' –

Antwort

3

Ihre Anwendung fehlt die procfile fügen Sie es hinzu und versuchen Sie es dann.
Hilfe https://devcenter.heroku.com/articles/procfile
Beispiel für procfile

web:python manage.py runserver 
web: gunicorn your-app-name.wsgi --log-file - 
heroku ps:scale web=1 
+0

danke für die antwort. Mein Procfile befindet sich im selben Verzeichnis wie meine requirements.txt. Das ist mein Problem – losee

+0

@losee das ist kein Problem. Ich habe ein Beispiel für procfile hinzugefügt. –

+0

das funktioniert immer noch nicht. Soll ich Procfile mit einer Periode am Ende haben? Wie dieses Procfile. Ich verstehe nicht, warum es nicht mein Procfile liest – losee

1

dazu kommt ziemlich spät, also nicht sicher, ob dies hilfreich sein wird. Ich habe Ihre Frage gefunden, weil ich das gleiche Problem hatte: Ich habe die von Heroku gelieferte Django-Vorlage verwendet und hatte definitiv eine Procfile im Stammverzeichnis des Projekts.

Welchen Ordner haben Sie gemacht $ git init in?

Mein Fehler war, dass ich einen Ordner ('WEB_CODE') auf meinem Desktop erstellt hatte, um dieses Projekt zu halten und diesen Ordner als Git Repo initialisiert. Das bedeutete, dass die Django-App in einem Unterordner unter WEB_CODE/myapp installiert wurde, so dass die Procfile die Wurzel von myapp war, die nicht der Kopf des Git Repos war.

Ich verschrottete dies und begann von vorne. Ich habe jetzt einen neuen Ordner, der alles enthält (angenommen, es heißt 'APP_CODE'), und nachdem ich die Heroku-gelieferte Django-App installiert habe, habe ich das Unterverzeichnis, das von dieser Installation erstellt wurde, zum Kopf des Git-Repos gemacht (zB: APP_CODE/myapp ist das Repo, nicht APP_CODE). Folglich war das Procfile dann die Wurzel des Projekts.

Ich habe die Änderungen übernommen, zu meinem persönlichen Github geschoben, und dann habe ich die $heroku create und $ git push heroku master Befehle erneut versucht und sie arbeiteten wie ein Charme.

0

Sorry, wenn spät, aber ich entdeckte es in letzter Zeit nach 2 Stunden Googeln, um eine Antwort zu finden Das Problem war, dass ich die Datei "procfile" mit Kleinbuchstaben p umbenannt. Also habe ich es in "Procfile" umbenannt mit Großbuchstaben P. Dann habe ich das Git Repo neu erstellt, dann hinzugefügt, um sie zu Bühne, dann hat sie begangen. Danach habe ich meinen Zweig in meinem Fall "Meister" zu Heroku geschoben und es hat gut für mich funktioniert.

Ich sage es nur für den Fall, dass jemand in den gleichen Fehler stecken geblieben ist.

0

Ich hatte dieses frustrierende Problem, aber ich habe endlich mein Procfile zur Arbeit gebracht. 1. Stelle sicher, dass du es "Procfile" ohne ".exe" oder ".txt" oder ".bat" nennst. Einfach "Procfile". Für Django enthalten ich folgendes jeder in seiner eigenen Zeile innerhalb des procfile:

web:python manage.py runserver 
web: gunicorn app-name.wsgi 
heroku ps:scale web=1 

Dann, auch wenn Sie diese vorher getan haben, müssen Sie CD in die Datei cmd verwenden, wo Ihr Projekt ist, und geben Sie die folgenden Befehle und nach jedem Befehl getroffen:

pip freeze > requirements.txt 
git init 
git add . 
git status 
git commit -m "Initial Commit" 
git push heroku master 
heroku open 

Dies ist, was für mich gearbeitet.

0

Ich habe gerade dieses Problem hatte, das procfile mit dem Befehl erstellen, nicht durch ein erstelltes-Datei umbenennen:

echo web:..etc>Procfile  (without spaces) 
Verwandte Themen