簡體   English   中英

在 Heroku 上部署 Flask 應用程序 - web1:crashed

[英]Deploying Flask app on Heroku - web1:crashed

我正在嘗試將 Flask 應用程序部署到 Heroku ,但收到此錯誤:

(venv)rgb:~/flaskapp/app$ heroku ps
=== web (1X): `gunicorn app:app`
web.1: crashed 2014/07/09 21:39:45 (~ 10s ago)

它在本地與“工頭開始”一起工作,但將其推送到 Heroku 網絡崩潰:

(venv)rgb@rgb-K45VD:~/flaskapp/app$ foreman start 
21:41:01 web.1  | started with pid 3269

這是以下 heroku 日志:(venv)rgb@rgb-K45VD:~/flaskapp/app$ heroku 日志

2014-07-09T18:38:42.934053+00:00 heroku[api]: Enable Logplex by user
2014-07-09T18:38:42.934053+00:00 heroku[api]: Release v2 created by user
2014-07-09T18:38:57+00:00 heroku[slug-compiler]: Slug compilation started
2014-07-09T18:39:31+00:00 heroku[slug-compiler]: Slug compilation finished
2014-07-09T18:39:30.976889+00:00 heroku[api]: Scale to web=1 by user
2014-07-09T18:39:31.123082+00:00 heroku[api]: Deploy ea4c116 by user
2014-07-09T18:39:31.123204+00:00 heroku[api]: Release v3 created by user
2014-07-09T18:39:35.095809+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2014-07-09T18:39:38.231874+00:00 heroku[web.1]: State changed from starting to crashed
2014-07-09T18:39:38.232507+00:00 heroku[web.1]: State changed from crashed to starting
2014-07-09T18:39:38.229063+00:00 heroku[web.1]: Process exited with status 3
2014-07-09T18:39:42.092210+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2014-07-09T18:39:44.747854+00:00 heroku[web.1]: State changed from starting to up
2014-07-09T18:39:46.210641+00:00 heroku[web.1]: State changed from up to crashed
2014-07-09T18:39:46.180463+00:00 heroku[web.1]: Process exited with status 3
2014-07-09T18:39:50.025372+00:00 heroku[api]: Scale to web=1 by user
2014-07-09T18:41:30.849878+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flazkeh.herokuapp.com request_id=89f286f6-44ec-4751-91ec-7411857fbd80 fwd="80.223.191.140" dyno= connect= service= status=503 bytes=
2014-07-09T18:41:31.434515+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=flazkeh.herokuapp.com request_id=63c33396-87d9-4b33-89a5-3f2288b707cd fwd="80.223.191.140" dyno= connect= service= status=503 bytes=

這似乎是錯誤:

2014-07-09T18:41:30.849878+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flazkeh.herokuapp.com request_id=89f286f6-44ec-4751-91ec-7411857fbd80 fwd="80.223.191.140" dyno= connect= service= status=503 bytes=
2014-07-09T18:41:31.434515+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=flazkeh.herokuapp.com request_id=63c33396-87d9-4b33-89a5-3f2288b707cd fwd="80.223.191.140" dyno= connect= service= status=503 bytes=

任何幫助將不勝感激!

從表面上看代碼,我看不出有什么問題。 您是否嘗試在自己的機器上運行它?

順便說一下,代碼中有一些東西導致它無法在我的機器上運行:

  • 需要有一個環境變量“APP_SETTINGS”(你設置了嗎?)
  • 需要有一個 models.py 模塊 - 可能包含 BlogPost 類。 GitHub上好像沒有這樣的文件?
  • 你安裝了flask-sqlalchemy嗎?

確保您將 procfile 從web: gunicorn app:app更改為web: gunicorn project:app 此外,一旦您部署到 heroku,您就會遇到數據庫問題。 最好的辦法是“刪除”數據庫並創建一個新的或遷移。 使用命令heroku logs獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM