Heim  >  Fragen und Antworten  >  Hauptteil

Warum kann das Projekt nicht an Heroku weitergeleitet werden?

Pushen Sie das Projekt gemäß dem Tutorial auf Heroku. In den vorherigen Schritten lief alles reibungslos und ohne Fehler. Bis hier ein Problem auftrat, wurde online keine Lösung gefunden. . .

Es fühlt sich an, als ob mit der Einstellung.py etwas nicht stimmt, aber es ist dasselbe wie im Tutorial:

Heroku-Einstellungen

if os.getcwd()=='/app':

import dj_database_url
DATABASES={
    'default':dj_database_url.config(default='postgres://localhost')
}

SECURY_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https')

ALLOWED_HOSTS = ['*']

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

Fehlerbericht über die Befehlszeile:

(ll_env) G:python_dorest>heroku create
App erstellen... fertig, protected-crag-1803
https://protected-crag-1803.h... | ...

(ll_env) G:python_dorest>git push heroku master
Objekte zählen: 48, fertig.
Delta-Komprimierung mit bis zu 4 Threads.
Objekte komprimieren: 100 % (39/39), fertig.
Objekte schreiben: 100 % ( 48/48), 11,18 KiB |. 0 Bytes/s, fertig.
Insgesamt 48 (Delta 3), wiederverwendet 0 (Delta 0)
remote: Quelldateien werden komprimiert... fertig.
remote: Quelle erstellen:
remote:
remote: -----> Python-App erkannt
remote: -----> Python-3.5.2 installieren

————————Der mittlere Inhalt wird weggelassen————————

remote: Setup.py-Installation für django-bootstrap3 ausführen: gestartet
remote: setup.py-Installation für django-bootstrap3 ausführen: abgeschlossen mit Status „Fertig“
remote: Django-1.11.2 dj-database-url-0.4 erfolgreich installiert .2 dj-static-0.0.6 django-bootstrap3-8.2.3 gunicorn-19.7.1 psycopg2-2.7.1 pytz-2017.2 static3-0.7.0
remote:
remote: -----> $ python manage.py Collectstatic --noinput
remote: Traceback (letzter Aufruf zuletzt):
remote: Datei „manage.py“, Zeile 22, in <module>
remote:execute_from_command_line(sys.argv)
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py“, Zeile 363, inexecute_from_command_line
remote: Utility.execute()
remote: Datei „/ app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py“, Zeile 355, in Execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py“, Zeile 283, in run_from_argv
remote: self.execute(args, * cmd_options)
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py“, Zeile 330, in ausführen
remote: Ausgabe = self.handle( Argumente, *Optionen)
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py“, Zeile 199, im Handle
remote: gesammelt = self.collect()
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py“, Zeile 124 , in Collect
remote: handler(path, prefixed_path, storage)
remote: Datei „/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py ", Zeile 354, in copy_file
remote: if not self.delete_file(path, prefixed_path, source_storage):
remote: File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/ staticfiles/management/commands/collectstatic.py“, Zeile 260, in delete_file
remote: if self.storage.exists(prefixed_path):
remote: File „/app/.heroku/python/lib/python3.5/site- packets/django/core/files/storage.py“, Zeile 392, in exist
remote: return os.path.exists(self.path(name))
remote: File „/app/.heroku/python/lib/ python3.5/site-packages/django/contrib/staticfiles/storage.py“, Zeile 50, im Pfad
remote: raise ImproperlyConfigured(“Sie verwenden die Staticfiles-App „
remote: django.core.Exceptions.ImproperlyConfigured: Sie verwenden die Staticfiles-App, ohne die Einstellung STATIC_ROOT auf einen Dateisystempfad festgelegt zu haben.
remote:
remote: ! Fehler beim Ausführen von „$ python manage.py Collectstatic --noinput“.
remote: Weitere Informationen finden Sie im Traceback oben.
remote:
remote: Möglicherweise müssen Sie den Anwendungscode aktualisieren, um diesen Fehler zu beheben.
remote: Oder Sie können Collectstatic für diese Anwendung deaktivieren:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/...
remote: ! Push abgelehnt, Python-App konnte nicht kompiliert werden.
remote:
remote: ! Push fehlgeschlagen
remote: Bereitstellung wird überprüft...
remote:
remote: ! Push abgelehnt an protected-crag-1803.
remote:
An https://git.heroku.com/protec...
! [Remote abgelehnt] Master -> Master (Pre-Receive-Hook abgelehnt)
Fehler: Einige Refs konnten nicht an „https://git.heroku.com/protec...“ gesendet werden

巴扎黑巴扎黑2662 Tage vor857

Antworte allen(1)Ich werde antworten

  • 淡淡烟草味

    淡淡烟草味2017-07-05 10:36:52

    好好看错误日志啊:

    remote: File "/app/.heroku/python/lib/python3.5/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.

    Antwort
    0
  • StornierenAntwort