2016-11-01 12 views
3

herokuにPythonスクリプトをデプロイしています.ごとに別のサーバーに要求します。

デプロイメントは良好ですが、logsが表示されたら、私はこれらを持っていますerrors

2016-11-01T07:42:12.919755+00:00 heroku[web.1]: Starting process with command `python script.py --log-file -` 
2016-11-01T07:43:13.097413+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-11-01T07:43:13.097556+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-11-01T07:43:13.196156+00:00 heroku[web.1]: Process exited with status 137 
2016-11-01T07:43:13.212942+00:00 heroku[web.1]: State changed from starting to crashed 
2016-11-01T07:43:13.213858+00:00 heroku[web.1]: State changed from crashed to starting 
2016-11-01T07:43:16.719828+00:00 heroku[web.1]: Starting process with command `python script.py --log-file -` 
2016-11-01T07:44:17.215381+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-11-01T07:44:17.215381+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-11-01T07:44:17.364708+00:00 heroku[web.1]: Process exited with status 137 
2016-11-01T07:44:17.367610+00:00 heroku[web.1]: State changed from starting to crashed 

Procfile

web: python script.py --log-file - 

script.py

import sys 
import requests 
from apscheduler.schedulers.blocking import BlockingScheduler 

sched = BlockingScheduler() 

@sched.scheduled_job('interval', minutes=3) 
def timed_job(): 
    try: 
     request = requests.get(url='https://royal-tag-services.herokuapp.com/api/sms-service/scheduler/') 
    except Exception as e: 
     print >>sys.stderr, 'scheduler request failed' 

sched.start() 

Result of 'tree -L 1' command

├── Procfile 
├── requirements.txt 
├── script.py 
└── supporterenv 

答えて

5

あなたProcfileの "労働者" と "ウェブ" を交換してください。

+0

はいそれは働いた。しかし答えを説明してください。 –

+0

私はそれが動作していると思った。しかし、これは私がエロスを見たときに得たものです。 2016-11-01T08:22:20.356683 + 00:00 heroku [api]:[email protected]で96b1efeを展開する 2016-11-01T08:22:20.356782 + 00:00 heroku [api]:リリースv10が作成されました[email protected] 2016-11-01T08:22:20.422315 + 00:00英雄[web.1]:状態がクラッシュからダウンに変わった 2016-11-01T08:22:20.572330 + 00:00英雄[スラッグコンパイラ]:スラッグコンパイルが開始されました 2016-11-01T08:22:20.572340 + 00:00 heroku [slugコンパイラ]:スラッグコンパイルが完了しました –

+1

Procfileに "web"プロセスタイプがある場合は、そのプロセスはhttp/sを介して着信するWebリクエストに応答できるように、(デフォルトでは)60秒以内に割り当てられた$ PORTにバインドする必要があります。そうでなければ、Herokuはhttps://devcenter.heroku.com/articles/error-codes#r10-boot-timeoutで説明されているようにdynoを削除します。 あなたのpythonスクリプトはWebサーバではないので、Procfile内のそのエントリは "web"プロセスタイプとして定義されるべきではありません。 –

関連する問題