私はUbuntu 12.04システムでスーパーバイザからGunicornを実行しようとしています。 GunicornはFlaskアプリケーション(Flaskの組み込みサーバーでテストされた簡単なREST Webサービス)を実行します。私はGunicornをインストールするときにGunicornサーバーを実行するので、GITリポジトリをクローンし、 'apt-get install'を避けようとしています。私はそれを実行したくない、それはスーパーバイザーだけが実行されます。スーパーバイザがGunicorn + Flaskと連携していません
私がしようとした場合そうした後、それをインストール:
cd /usr/local/bin
gunicorn my_app:app -c /path/to/gu_config_file
Gunicornで動作します。それから私はそれを殺す。拡張子を付けないで設定ファイルに注意してください。なぜなら '.py'拡張子は私のためには機能しないからです。 だから私のようなスーパーバイザーのconfigファイルを編集します。スーパーバイザで
[program:gunicorn]
command=/usr/local/bin/gunicorn my_app:app -c /path/to/.gu_setup
directory=/usr/local/bin/
autostart=true
autorestart=true
redirect_stderr=True
および更新の変更:
supervisorctl reread
# gunicorn: changed
supervisorctl update
# gunicorn: stopped
# gunicorn: updated process group
は、ファイルの変更を検出し、Gunicornプログラムのために動作します。 [OK]を、その後私はそれを起動しよう:
supervisorctl start gunicorn
迷惑行き方:
gunicorn: ERROR (abnormal termination)
は上司のログを確認する:私は今何をすべきか分からない
2013-03-08 13:07:22,378 INFO spawned: 'gunicorn' with pid 3355
2013-03-08 13:07:22,916 INFO exited: gunicorn (exit status 3; not expected)
2013-03-08 13:07:23,918 INFO spawned: 'gunicorn' with pid 3361
2013-03-08 13:07:24,492 INFO exited: gunicorn (exit status 3; not expected)
2013-03-08 13:07:26,496 INFO spawned: 'gunicorn' with pid 3367
2013-03-08 13:07:27,078 INFO exited: gunicorn (exit status 3; not expected)
2013-03-08 13:07:30,085 INFO spawned: 'gunicorn' with pid 3373
2013-03-08 13:07:30,628 INFO exited: gunicorn (exit status 3; not expected)
2013-03-08 13:07:31,630 INFO gave up: gunicorn entered FATAL state, too many start retries too quickly
.. 。 手伝って頂けますか? Thxたくさん!/usr/local/binにある
export PYTHONPATH=/usr/local/bin:/usr/local/lib/project
'MY_APP':
編集:私はと私はPYTHONPATH変数をエクスポートしたと言うのを忘れて申し訳ありません。他のモジュールにはlibパスが必要です。 私は次のように、環境変数を示すためにも、スーパーバイザーの設定ファイルを編集した:
environment=PYTHONPATH=/usr/local/bin:/usr/local/lib/project/
しかし、動作しませんでした。
EDIT 2:彼のコメントで示唆@robertklepとして、これは、ログの出力です:...
Traceback (most recent call last):
File "/tmp/gunicorn/gunicorn/arbiter.py", line 485, in spawn_worker
worker.init_process()
File "/tmp/gunicorn/gunicorn/workers/base.py", line 100, in init_process
self.wsgi = self.app.wsgi()
File "/tmp/gunicorn/gunicorn/app/base.py", line 103, in wsgi
self.callable = self.load()
File "/tmp/gunicorn/gunicorn/app/wsgiapp.py", line 25, in load
return util.import_app(self.app_uri)
File "/tmp/gunicorn/gunicorn/util.py", line 369, in import_app
__import__(module)
File "/usr/local/bin/my_app.py", line 4, in <module>
import const
ImportError: No module named const
2013-03-08 13:29:35 [3670] [INFO] Worker exiting (pid: 3670)
2013-03-08 13:29:36 [3665] [INFO] Shutting down: Master
2013-03-08 13:29:36 [3665] [INFO] Reason: Worker failed to boot.
'のconst' モジュールが/ usr/local/lib /プロジェクト内にある
はい、私はそれを行い、同時に私の質問を編集していました...ごめんなさい!私はあなたが言ったことをやっている、それを待つ! :) –
私はそれが 'const'モジュールを見つけることができないと言っていますが、/ usr/local/lib/projectにスーパーバイザの設定ファイルの環境に追加されています... –
パスを直接gunicornに渡すことについて私の編集を参照してください。 – robertklep