简体   繁体   English

Django 应用程序在部署到 Heroku 时崩溃 - 错误 H10

[英]Django app crashes on deploying to Heroku - Error H10

demo.txt I am trying to deploy my django app on heroku and it crashes with exit status 1 error code h10. demo.txt 我正在尝试在 heroku 上部署我的 django 应用程序,它崩溃并出现退出状态 1 错误代码 h10。 I am deploying to heroku for the first time and cannot find a fix.我是第一次部署到 heroku 并且找不到修复程序。 It is a simple project so i was trying to deploy it on sqlite database only.这是一个简单的项目,所以我试图仅将它部署在 sqlite 数据库上。 My project name is portfolio, appname is mywebsite我的项目名称是投资组合,appname 是 mywebsite

heroku logs heroku 日志

2020-06-05T12:58:10.098179+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-05T12:58:15.673642+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp.herokuapp.com request_id=a553ec3b-75b5-46c6-bf04-a3a2cfd6829c fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T12:58:16.236791+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=e0f1cc63-1163-45c1-855d-784e1a1536be fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T13:13:36.052752+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp.herokuapp.com request_id=5c0b2b72-48aa-412d-b6b7-1560fb6c72cc fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T13:13:37.136635+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=88373377-a732-490d-a420-8b2295739eb3 fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T13:13:44.436995+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp.herokuapp.com request_id=8fed326e-1da8-44a3-a79d-52df93f307e6 fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T13:13:45.262259+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=85a7b359-74ef-40ee-8c08-f89cab6a2349 fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T13:18:29.000000+00:00 app[api]: Build started by user *******@gmail.com
2020-06-05T13:19:02.798192+00:00 app[api]: Deploy 0823f045 by user *******@gmail.com
2020-06-05T13:19:02.798192+00:00 app[api]: Release v17 created by user *******.com
2020-06-05T13:19:02.976994+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-05T13:19:08.312035+00:00 heroku[web.1]: Starting process with command `gunicorn portfolio.wsgi --preload`
2020-06-05T13:19:10.635974+00:00 app[web.1]: Traceback (most recent call last):
2020-06-05T13:19:10.636006+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-06-05T13:19:10.636228+00:00 app[web.1]: sys.exit(run())
2020-06-05T13:19:10.636229+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2020-06-05T13:19:10.636466+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-06-05T13:19:10.636467+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
2020-06-05T13:19:10.636768+00:00 app[web.1]: super().run()
2020-06-05T13:19:10.636772+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-06-05T13:19:10.637030+00:00 app[web.1]: Arbiter(self).run()
2020-06-05T13:19:10.637031+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 58, in __init__
2020-06-05T13:19:10.637283+00:00 app[web.1]: self.setup(app)
2020-06-05T13:19:10.637284+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 118, in setup
2020-06-05T13:19:10.637512+00:00 app[web.1]: self.app.wsgi()
2020-06-05T13:19:10.637518+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-05T13:19:10.637755+00:00 app[web.1]: self.callable = self.load()
2020-06-05T13:19:10.637759+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-06-05T13:19:10.638012+00:00 app[web.1]: return self.load_wsgiapp()
2020-06-05T13:19:10.638013+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-06-05T13:19:10.638159+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-06-05T13:19:10.638163+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-06-05T13:19:10.638414+00:00 app[web.1]: mod = importlib.import_module(module)
2020-06-05T13:19:10.638415+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-06-05T13:19:10.638589+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-06-05T13:19:10.638589+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-05T13:19:10.638720+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-05T13:19:10.638751+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-06-05T13:19:10.638850+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-06-05T13:19:10.638929+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-06-05T13:19:10.639053+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-06-05T13:19:10.639162+00:00 app[web.1]: File "/app/portfolio/wsgi.py", line 2, in <module>
2020-06-05T13:19:10.639259+00:00 app[web.1]: from whitenoise.django import DjangoWhiteNoise
2020-06-05T13:19:10.639260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/whitenoise/django.py", line 2, in <module>
2020-06-05T13:19:10.639378+00:00 app[web.1]: "\n\n"
2020-06-05T13:19:10.639378+00:00 app[web.1]: ImportError:
2020-06-05T13:19:10.639379+00:00 app[web.1]: 
2020-06-05T13:19:10.639379+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
2020-06-05T13:19:10.639379+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
2020-06-05T13:19:10.639380+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
2020-06-05T13:19:10.639380+00:00 app[web.1]: 
2020-06-05T13:19:10.639380+00:00 app[web.1]: 
2020-06-05T13:19:10.723127+00:00 heroku[web.1]: Process exited with status 1
2020-06-05T13:19:10.764298+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-05T13:19:10.766540+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-05T13:19:13.000000+00:00 app[api]: Build succeeded
2020-06-05T13:19:16.421599+00:00 heroku[web.1]: Starting process with command `gunicorn portfolio.wsgi --preload`
2020-06-05T13:19:18.987816+00:00 app[web.1]: Traceback (most recent call last):
2020-06-05T13:19:18.987848+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-06-05T13:19:18.988034+00:00 app[web.1]: sys.exit(run())
2020-06-05T13:19:18.988039+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2020-06-05T13:19:18.988247+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-06-05T13:19:18.988278+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
2020-06-05T13:19:18.988557+00:00 app[web.1]: super().run()
2020-06-05T13:19:18.988579+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-06-05T13:19:18.988813+00:00 app[web.1]: Arbiter(self).run()
2020-06-05T13:19:18.988816+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 58, in __init__
2020-06-05T13:19:18.989039+00:00 app[web.1]: self.setup(app)
2020-06-05T13:19:18.989043+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 118, in setup
2020-06-05T13:19:18.989275+00:00 app[web.1]: self.app.wsgi()
2020-06-05T13:19:18.989279+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-05T13:19:18.989493+00:00 app[web.1]: self.callable = self.load()
2020-06-05T13:19:18.989497+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-06-05T13:19:18.989693+00:00 app[web.1]: return self.load_wsgiapp()
2020-06-05T13:19:18.989714+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-06-05T13:19:18.989905+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-06-05T13:19:18.989908+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-06-05T13:19:18.990285+00:00 app[web.1]: mod = importlib.import_module(module)
2020-06-05T13:19:18.990308+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-06-05T13:19:18.990539+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-06-05T13:19:18.990574+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-05T13:19:18.990768+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-05T13:19:18.990920+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-06-05T13:19:18.991076+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-06-05T13:19:18.991223+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-06-05T13:19:18.991403+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-06-05T13:19:18.991563+00:00 app[web.1]: File "/app/portfolio/wsgi.py", line 2, in <module>
2020-06-05T13:19:18.991725+00:00 app[web.1]: from whitenoise.django import DjangoWhiteNoise
2020-06-05T13:19:18.991746+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/whitenoise/django.py", line 2, in <module>
2020-06-05T13:19:18.991911+00:00 app[web.1]: "\n\n"
2020-06-05T13:19:18.991941+00:00 app[web.1]: ImportError:
2020-06-05T13:19:18.991941+00:00 app[web.1]: 
2020-06-05T13:19:18.991942+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
2020-06-05T13:19:18.991942+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
2020-06-05T13:19:18.991942+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
2020-06-05T13:19:18.991942+00:00 app[web.1]: 
2020-06-05T13:19:18.991960+00:00 app[web.1]: 
2020-06-05T13:19:19.089699+00:00 heroku[web.1]: Process exited with status 1
2020-06-05T13:19:19.134349+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-05T13:19:25.340939+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp.herokuapp.com request_id=fffbbf1f-d1b1-4fbf-a4de-3a8a3eb5f0dd fwd="106.204.196.204" dyno= connect= service= status=503 bytes= protocol=https

heroku ps heroku ps

=== web (Free): gunicorn portfolio.wsgi --preload (1)
web.1: crashed 2020/06/05 18:49:19 +0530 (~ 22m ago)

Procfile档案

web: gunicorn portfolio.wsgi --preload

wsgi wsgi

import os
from whitenoise.django import DjangoWhiteNoise

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.settings')

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

requirements.txt要求.txt

asgiref==3.2.7
Django==3.0.7
docutils==0.15.2
gunicorn==20.0.4
jmespath==0.10.0
Pillow==7.1.2
python-dateutil==2.8.1
pytz==2020.1
s3transfer==0.3.3
six==1.15.0
sqlparse==0.3.1
urllib3==1.25.9
whitenoise==5.1.0

Project structure项目结构

├── db.sqlite3
├── manage.py
├── mywebsite
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── __init__.py
│   ├── migrations
│   ├── models.py
│   ├── __pycache__
│   ├── static
│   ├── templates
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── portfolio
│   ├── asgi.py
│   ├── __init__.py
│   ├── __pycache__
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── Procfile
└── requirements.txt

The error is described in logs along with the way to fix it:日志中描述了该错误以及修复它的方法:

2020-06-05T13:19:18.991941+00:00 app[web.1]: ImportError:
2020-06-05T13:19:18.991941+00:00 app[web.1]: 
2020-06-05T13:19:18.991942+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
2020-06-05T13:19:18.991942+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
2020-06-05T13:19:18.991942+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM