Bereitstellung von Python-django-Projekt auf Heroku

Ich versuche, eine kleine Test-App auf Heroku zu implementieren, es wird an Heroku-Master ohne Fehler gedrückt, aber beim Ausführen der App gibt Anwendungsfehler. Ich überprüfte die Heroku-Protokolle und bekam den folgenden Fehler:

**2015-07-11T03:56:03.004853+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11T03:56:03.048862+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [3] [INFO] Reason: Worker failed to boot. 2015-07-11T03:56:03.004854+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11T03:56:03.004855+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11T03:56:03.004857+00:00 app[web.1]: self.callable = self.load() 2015-07-11T03:56:03.004858+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11T03:56:03.004859+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11T03:56:03.004860+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11T03:56:03.004861+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11T03:56:03.004863+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11T03:56:03.004865+00:00 app[web.1]: File "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11T03:56:03.004864+00:00 app[web.1]: __import__(module) 2015-07-11T03:56:03.004866+00:00 app[web.1]: from dj_static import Cling 2015-07-11T03:56:03.004868+00:00 app[web.1]: ImportError: No module named dj_static 2015-07-11T03:56:03.005003+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [10] [INFO] Worker exiting (pid: 10) 2015-07-11T03:56:03.048672+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [3] [INFO] Shutting down: Master 2015-07-11T03:56:03.955134+00:00 heroku[web.1]: State changed from up to crashed 2015-07-11T03:56:03.955995+00:00 heroku[web.1]: State changed from crashed to starting 2015-07-11T03:56:03.934809+00:00 heroku[web.1]: Process exited with status 3 2015-07-11T03:56:07.906911+00:00 heroku[web.1]: Starting process with command `gunicorn semicoloninc.wsgi:application` 2015-07-11T03:56:09.283990+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [INFO] Starting gunicorn 19.3.0 2015-07-11T03:56:09.320937+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [INFO] Booting worker with pid: 10 2015-07-11T03:56:09.284694+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [INFO] Listening at: http://0.0.0.0:57450 (3) 2015-07-11T03:56:09.284785+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [INFO] Using worker: sync 2015-07-11T03:56:09.296813+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [INFO] Booting worker with pid: 9 2015-07-11T03:56:09.545553+00:00 heroku[web.1]: State changed from starting to up 2015-07-11T03:56:09.937863+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [ERROR] Exception in worker process: 2015-07-11T03:56:09.937869+00:00 app[web.1]: Traceback (most recent call last): 2015-07-11T03:56:09.937872+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11T03:56:09.937873+00:00 app[web.1]: worker.init_process() 2015-07-11T03:56:09.937875+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11T03:56:09.937878+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11T03:56:09.937876+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11T03:56:09.937879+00:00 app[web.1]: self.callable = self.load() 2015-07-11T03:56:09.937882+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11T03:56:09.937881+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11T03:56:09.937884+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11T03:56:09.937885+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11T03:56:09.937887+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11T03:56:09.937888+00:00 app[web.1]: __import__(module) 2015-07-11T03:56:09.937890+00:00 app[web.1]: File "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11T03:56:09.937891+00:00 app[web.1]: from dj_static import Cling 2015-07-11T03:56:09.937893+00:00 app[web.1]: ImportError: No module named dj_static 2015-07-11T03:56:09.937894+00:00 app[web.1]: Traceback (most recent call last): 2015-07-11T03:56:09.937895+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11T03:56:09.937896+00:00 app[web.1]: worker.init_process() 2015-07-11T03:56:09.937898+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11T03:56:09.937899+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11T03:56:09.937900+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11T03:56:09.937901+00:00 app[web.1]: self.callable = self.load() 2015-07-11T03:56:09.937903+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11T03:56:09.937904+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11T03:56:09.937905+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11T03:56:09.937906+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11T03:56:09.937908+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11T03:56:09.937910+00:00 app[web.1]: File "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11T03:56:09.937909+00:00 app[web.1]: __import__(module) 2015-07-11T03:56:09.937912+00:00 app[web.1]: from dj_static import Cling 2015-07-11T03:56:09.937913+00:00 app[web.1]: ImportError: No module named dj_static 2015-07-11T03:56:09.938031+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [INFO] Worker exiting (pid: 9) 2015-07-11T03:56:09.965385+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [ERROR] Exception in worker process: 2015-07-11T03:56:09.965391+00:00 app[web.1]: Traceback (most recent call last): 2015-07-11T03:56:09.965394+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11T03:56:09.965396+00:00 app[web.1]: worker.init_process() 2015-07-11T03:56:09.965397+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11T03:56:09.965398+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11T03:56:09.965400+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11T03:56:09.965402+00:00 app[web.1]: self.callable = self.load() 2015-07-11T03:56:09.965404+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11T03:56:09.965405+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11T03:56:09.965408+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11T03:56:09.965410+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11T03:56:09.965406+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11T03:56:09.965411+00:00 app[web.1]: __import__(module) 2015-07-11T03:56:09.965414+00:00 app[web.1]: from dj_static import Cling 2015-07-11T03:56:09.965415+00:00 app[web.1]: ImportError: No module named dj_static 2015-07-11T03:56:09.965412+00:00 app[web.1]: File "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11T03:56:09.965416+00:00 app[web.1]: Traceback (most recent call last): 2015-07-11T03:56:09.965418+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11T03:56:09.965419+00:00 app[web.1]: worker.init_process() 2015-07-11T03:56:09.965420+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11T03:56:09.965422+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11T03:56:09.965423+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11T03:56:09.965424+00:00 app[web.1]: self.callable = self.load() 2015-07-11T03:56:09.965425+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11T03:56:09.965427+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11T03:56:09.965428+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11T03:56:09.965429+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11T03:56:09.965430+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11T03:56:09.965434+00:00 app[web.1]: __import__(module) 2015-07-11T03:56:09.965435+00:00 app[web.1]: File "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11T03:56:09.965436+00:00 app[web.1]: from dj_static import Cling 2015-07-11T03:56:09.965438+00:00 app[web.1]: ImportError: No module named dj_static 2015-07-11T03:56:09.978589+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [INFO] Shutting down: Master 2015-07-11T03:56:09.965533+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [INFO] Worker exiting (pid: 10) 2015-07-11T03:56:09.978679+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [INFO] Reason: Worker failed to boot. 2015-07-11T03:56:10.732554+00:00 heroku[web.1]: State changed from up to crashed 2015-07-11T03:56:10.716153+00:00 heroku[web.1]: Process exited with status 3 2015-07-11T03:56:15.464379+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fuddi.herokuapp.com request_id=aa45beef-2257-42b4-a4f7-60decf81282d fwd="120.59.67.176" dyno=web.1 connect=5013ms service= status=503 bytes= 2015-07-11T03:56:17.331663+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fuddi.herokuapp.com request_id=bbd9b863-14b7-4fce-b02e-d13b1c9e1b4c fwd="120.59.67.176" dyno= connect= service= status=503 bytes= 2015-07-11T03:56:18.072135+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fuddi.herokuapp.com request_id=60f31c6e-55af-440b-8842-f6b7c4727919 fwd="120.59.67.176" dyno= connect= service= status=503 bytes=** 

Ich weiß, es gibt ein Problem mit Import und Gunicorn und WSGI Importe. Bitte hilf mir.

Mein Procfile ist:

 web: gunicorn semicoloninc.wsgi:application 

Wsgi.py

 import os from django.core.wsgi import get_wsgi_application from dj_static import Cling os.environ.setdefault("DJANGO_SETTINGS_MODULE", "semicoloninc.settings") 

Einstellungen.py

 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # Allow all host headers ALLOWED_HOSTS = ['*'] # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SETTINGS_DIR = os.path.dirname(__file__) PROJECT_PATH = os.path.join(SETTINGS_DIR, os.pardir) PROJECT_PATH = os.path.abspath(PROJECT_PATH) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'fhi2%%r#ck5kfl-42#t$bil+hxtlpp7wj42lpd8zv0i#%^2iiz' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates') STATIC_PATH = os.path.join(PROJECT_PATH, 'static') # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'contactUs', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'semicoloninc.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_PATH], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'semicoloninc.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = ( STATIC_PATH, ) application = Cling(get_wsgi_application()) 

  • Erste Schritte mit Python auf Heroku - pg_config ausführbare Datei nicht gefunden
  • Führen Sie Python CGI Anwendung auf Heroku
  • Serve eine Flasche Anwendung von Gunicorn auf Heroku?
  • Gunicorn Verbindung in Gebrauch: ('0.0.0.0', 5000)
  • Kann nicht auf admin auf Heroku zugreifen
  • Konfigurieren von Gunicorn für Django auf Heroku
  • Heroku und verdreht
  • Django: plötzliche DB zurücksetzen nach Heroku schlafen
  • One Solution collect form web for “Bereitstellung von Python-django-Projekt auf Heroku”

    Scheint, dass es aus Ihren Protokollen klar sein sollte … ImportError: No module named dj_static und du willst keine offiziellen Dokumente lesen: D

    https://devcenter.heroku.com/articles/getting-started-with-django

    pip install django-toolbelt

    Installieren von gesammelten Paketen: Django, psycopg2, gunicorn, dj-datenbank-url, dj-statisch , statisch

    Erfolgreich installiert Django psycopg2 gunicorn dj-datenbank-url dj-statische statische Aufräumen …

    Python ist die beste Programmiersprache der Welt.