Я успешно развернул свое веб-приложение Django на Heroku, но получил сообщение Application Error
. Но веб-приложение на локальном сервере работает правильно.
Here is my application log:
2020-08-04T03:32:15.540612+00:00 app[api]: Initial release by user rabby.jim999@gmail.com
2020-08-04T03:32:15.540612+00:00 app[api]: Release v1 created by user rabby.jim999@gmail.com
2020-08-04T03:32:15.857822+00:00 app[api]: Release v2 created by user rabby.jim999@gmail.com
2020-08-04T03:32:15.857822+00:00 app[api]: Enable Logplex by user rabby.jim999@gmail.com
2020-08-04T03:32:46.278800+00:00 app[api]: Set DISABLE_COLLECTSTATIC config vars by user rabby.jim999@gmail.com
2020-08-04T03:32:46.278800+00:00 app[api]: Release v3 created by user rabby.jim999@gmail.com
2020-08-04T03:34:06.000000+00:00 app[api]: Build started by user rabby.jim999@gmail.com
2020-08-04T03:34:47.143606+00:00 app[api]: Attach DATABASE (@ref:postgresql-perpendicular-61467) by user rabby.jim999@gmail.com
2020-08-04T03:34:47.143606+00:00 app[api]: Running release v4 commands by user rabby.jim999@gmail.com
2020-08-04T03:34:47.154813+00:00 app[api]: Release v5 created by user rabby.jim999@gmail.com
2020-08-04T03:34:47.154813+00:00 app[api]: @ref:postgresql-perpendicular-61467 completed provisioning, setting DATABASE_URL. by user rabby.jim999@gmail.com
2020-08-04T03:34:47.474554+00:00 app[api]: Deploy e6fcf034 by user rabby.jim999@gmail.com
2020-08-04T03:34:47.474554+00:00 app[api]: Release v6 created by user rabby.jim999@gmail.com
2020-08-04T03:34:47.495253+00:00 app[api]: Scaled to web@1:Free by user rabby.jim999@gmail.com
2020-08-04T03:34:53.033657+00:00 heroku[web.1]: Starting process with command `gunicorn newspaper_project.wsgi --log-file -`
2020-08-04T03:34:55.434601+00:00 app[web.1]: bash: gunicorn: command not found
2020-08-04T03:34:55.495150+00:00 heroku[web.1]: Process exited with status 127
2020-08-04T03:34:55.534079+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-04T03:34:55.536481+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-04T03:34:58.000000+00:00 app[api]: Build succeeded
2020-08-04T03:35:01.196411+00:00 heroku[web.1]: Starting process with command `gunicorn newspaper_project.wsgi --log-file -`
2020-08-04T03:35:03.730535+00:00 app[web.1]: bash: gunicorn: command not found
2020-08-04T03:35:03.780569+00:00 heroku[web.1]: Process exited with status 127
2020-08-04T03:35:03.822189+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-04T03:35:17.021136+00:00 app[api]: Release v7 created by user rabby.jim999@gmail.com
2020-08-04T03:35:17.021136+00:00 app[api]: Remove DISABLE_COLLECTSTATIC config vars by user rabby.jim999@gmail.com
2020-08-04T03:35:17.195336+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-04T03:35:21.619153+00:00 heroku[web.1]: Starting process with command `gunicorn newspaper_project.wsgi --log-file -`
2020-08-04T03:35:23.313884+00:00 app[web.1]: bash: gunicorn: command not found
2020-08-04T03:35:23.354703+00:00 heroku[web.1]: Process exited with status 127
2020-08-04T03:35:23.400595+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-04T03:35:26.401948+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-04T03:35:31.234524+00:00 heroku[web.1]: Starting process with command `gunicorn newspaper_project.wsgi --log-file -`
2020-08-04T03:35:33.166497+00:00 app[web.1]: bash: gunicorn: command not found
2020-08-04T03:35:33.216595+00:00 heroku[web.1]: Process exited with status 127
2020-08-04T03:35:33.251002+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-04T03:35:43.283543+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=itnewspaper.herokuapp.com request_id=65911b1e-d4c6-4
8a9-a170-3edcda5054b6 fwd="160.202.144.210" dyno= connect= service= status=503 bytes= protocol=https
2020-08-04T03:35:43.982143+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=itnewspaper.herokuapp.com request_id=8b87
f553-20a6-4ba4-9c12-0da730fac6a7 fwd="160.202.144.210" dyno= connect= service= status=503 bytes= protocol=https
2020-08-04T03:49:41.311592+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=itnewspaper.herokuapp.com request_id=acb47925-4576-4
355-8bc8-2a34c30e4c6c fwd="160.202.144.210" dyno= connect= service= status=503 bytes= protocol=https
2020-08-04T03:49:42.013324+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=itnewspaper.herokuapp.com request_id=2ec8
9a3e-8803-423a-ad61-835ae4502388 fwd="160.202.144.210" dyno= connect= service= status=503 bytes= protocol=https
The steps I followed to deploy:
pipenv lock
heroku login
touch Procfile
pip install gunicorn whitenoise django-heroku
heroku create itnewspaper
heroku git:remote -a itnewspaper
heroku config:set DISABLE_COLLECTSTATIC=1
git add -A
git commit -m "Heroku config"
git push heroku master
heroku ps:scale web=1
heroku config:unset DISABLE_COLLECTSTATIC
heroku restart
heroku open
My Procfile
:
web: gunicorn newspaper_project.wsgi --log-file -
My Pipfile
:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
django = "*"
[requires]
python_version = "3.7"
asgiref = "3.2.10"
dj-database-url = "0.5.0"
Django = "3.0.8"
django-crispy-forms = "1.9.2"
django-heroku = "0.3.1"
gunicorn = "19.9.0"
psycopg2 = "2.8.5"
pytz = "2020.1"
sqlparse = "0.3.1"
whitenoise = "5.1.0"
Here is my Pipfile.lock
:
{
"_meta": {
"hash": {
"sha256": "021bb8b6948e76168308f6200f1f2abc48a6a300c89ab19e93fcda0a5e298117"
},
"pipfile-spec": 6,
"requires": {
"Django": "3.0.8",
"asgiref": "3.2.10",
"dj-database-url": "0.5.0",
"django-crispy-forms": "1.9.2",
"django-heroku": "0.3.1",
"gunicorn": "19.9.0",
"psycopg2": "2.8.5",
"python_version": "3.7",
"pytz": "2020.1",
"sqlparse": "0.3.1",
"whitenoise": "5.1.0"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"asgiref": {
"hashes": [
"sha256:7e51911ee147dd685c3c8b805c0ad0cb58d360987b56953878f8c06d2d1c6f1a",
"sha256:9fc6fb5d39b8af147ba40765234fa822b39818b12cc80b35ad9b0cef3a476aed"
],
"version": "==3.2.10"
},
"django": {
"hashes": [
"sha256:96fbe04e8ba0df289171e7f6970e0ff8b472bf4f909ed9e0e5beccbac7e1dbbe",
"sha256:c22b4cd8e388f8219dc121f091e53a8701f9f5bca9aa132b5254263cab516215"
],
"index": "pypi",
"version": "==3.0.9"
},
"pytz": {
"hashes": [
"sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed",
"sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"
],
"version": "==2020.1"
},
"sqlparse": {
"hashes": [
"sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e",
"sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"
],
"version": "==0.3.1"
}
},
"develop": {}
}
runtime.txt:
python-3.7.7
Here is my project Ссылка GitHub