我使用Python和Flask運行我的應用app.py
。我試圖將它部署到Heroku,並且我遵循了this tutorial中的步驟,包括製作Procfile和requirements.txt。但是,每當我跑heroku local
,我得到以下錯誤:Python,Flask,Gunicorn錯誤:無法識別的參數
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Starting gunicorn 19.3.0
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Listening at: http://0.0.0.0:5000 (19422)
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Using worker: sync
web.1 | [2015-09-26 17:36:32 -0400] [19425] [INFO] Booting worker with pid: 19425
web.1 | usage: gunicorn [-h] [--auth_host_name AUTH_HOST_NAME]
web.1 | gunicorn: error: unrecognized arguments: app:app
web.1 | [2015-09-26 17:36:32 -0400] [19425] [INFO] Worker exiting (pid: 19425)
我以前在Heroku上部署的應用程序成功,但從未已經得到了這個錯誤。我的Procfile只是一行:web: gunicorn app:app
。
有誰能告訴我如何解決這個問題嗎?
UPDATE: 修改了一些我的代碼,現在當我運行heroku local
,它精緻運行:
web.1 | [2015-09-28 18:52:13 -0400] [70650] [INFO] Starting gunicorn 19.3.0
web.1 | [2015-09-28 18:52:13 -0400] [70650] [INFO] Listening at: http://0.0.0.0:5000 (70650)
web.1 | [2015-09-28 18:52:13 -0400] [70650] [INFO] Using worker: sync
web.1 | [2015-09-28 18:52:13 -0400] [70653] [INFO] Booting worker with pid: 70653
然而,當我部署我的Heroku上的應用程序,我得到一個應用程序錯誤,當我檢查日誌,我看到與以前一樣的錯誤:
2015-09-28T22:50:54.775077+00:00 app[web.1]: 2015-09-28 22:50:54 [3] [INFO] Starting gunicorn 18.0
2015-09-28T22:50:54.776176+00:00 app[web.1]: 2015-09-28 22:50:54 [3] [INFO] Using worker: sync
2015-09-28T22:50:54.776052+00:00 app[web.1]: 2015-09-28 22:50:54 [3] [INFO] Listening at: http://0.0.0.0:24995 (3)
2015-09-28T22:50:54.786067+00:00 app[web.1]: 2015-09-28 22:50:54 [9] [INFO] Booting worker with pid: 9
2015-09-28T22:50:56.004336+00:00 heroku[web.1]: State changed from starting to up
2015-09-28T22:51:42.659042+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=bobawithjames.herokuapp.com request_id=1afab4c0-484e-456b-be05-3086ee0711cd fwd="160.39.250.29" dyno=web.1 connect=1ms service=39ms status=503 bytes=0
2015-09-28T22:51:42.604331+00:00 app[web.1]: [--noauth_local_webserver]
2015-09-28T22:51:42.604323+00:00 app[web.1]: usage: gunicorn [-h] [--auth_host_name AUTH_HOST_NAME]
2015-09-28T22:51:42.604335+00:00 app[web.1]: [--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
2015-09-28T22:51:42.633611+00:00 app[web.1]: gunicorn: error: unrecognized arguments: hello:app
任何人都知道現在發生了什麼?
嘗試將您的文件重命名爲'main.py'並將Procfile更改爲:'web:gunicorn main:app' – ahmed
@ahmed我試過並得到相同的錯誤。還有其他建議嗎? – frogbandit
我有同樣的問題 - 任何人有修復? – crarho