我已成功將我的 Django Web 應用程序部署到 Heroku,但收到了Application Error消息。但是,Web 應用程序在本地服務器中正常運行。這是我的應用程序日志:2020-08-04T03:32:15.540612+00:00 app[api]: Initial release by user [email protected]:32:15.540612+00:00 app[api]: Release v1 created by user [email protected]:32:15.857822+00:00 app[api]: Release v2 created by user [email protected]:32:15.857822+00:00 app[api]: Enable Logplex by user [email protected]:32:46.278800+00:00 app[api]: Set DISABLE_COLLECTSTATIC config vars by user [email protected]:32:46.278800+00:00 app[api]: Release v3 created by user [email protected]:34:06.000000+00:00 app[api]: Build started by user [email protected]:34:47.143606+00:00 app[api]: Attach DATABASE (@ref:postgresql-perpendicular-61467) by user [email protected]:34:47.143606+00:00 app[api]: Running release v4 commands by user [email protected]:34:47.154813+00:00 app[api]: Release v5 created by user [email protected]:34:47.154813+00:00 app[api]: @ref:postgresql-perpendicular-61467 completed provisioning, setting DATABASE_URL. by user [email protected]:34:47.474554+00:00 app[api]: Deploy e6fcf034 by user [email protected]:34:47.474554+00:00 app[api]: Release v6 created by user [email protected]:34:47.495253+00:00 app[api]: Scaled to web@1:Free by user [email protected]: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 found2020-08-04T03:34:55.495150+00:00 heroku[web.1]: Process exited with status 1272020-08-04T03:34:55.534079+00:00 heroku[web.1]: State changed from starting to crashed2020-08-04T03:34:55.536481+00:00 heroku[web.1]: State changed from crashed to starting
1 回答

森林海
TA貢獻2011條經驗 獲得超2個贊
您將依賴項放在錯誤的位置。它們屬于[packages]
您的部分Pipfile
,而不是[requires]
部分。
通常,您應該很少需要手動編輯您的文件Pipfile
,并且您永遠不應該手動修改您的Pipfile.lock
. 不要向您添加東西Pipfile
,而是使用 來安裝它們pipenv
,例如通過運行
pipenv install gunicorn
Pipenv 會自動為你更新你的Pipfile
和Pipfile.lock
。
我建議您執行以下操作:
Pipfile.lock
本地刪除通過運行刪除舊的 virtualenv
pipenv --rm
移動除了
python_version = "3.7"
從[requires]
到[packages]
考慮更改所有版本,
"*"
以便 Pipenv 可以免費更新版本跑步
pipenv install
pipenv run
如果您使用或從運行它,請確保應用程序在本地工作pipenv shell
Pipfile.lock
提交Pipenv 生成的新內容部署
展望未來,我強烈建議您通過運行pipenv install
而不是Pipfile
手動修改或使用pip
. 這樣做的另一個好處是確保您的本地版本與 Heroku 上使用的版本相匹配。
runtime.txt
哦,如果您使用的是 Pipenv,則不需要。所需的 Python 版本已在您的Pipfile
.
添加回答
舉報
0/150
提交
取消