2017-03-22 10 views
0

私のホームフォルダにプロジェクトをクローンしました。それを/home/telessaudeとしましょう。だから、プロジェクトのルートは、私はDjangoプロジェクトのホームフォルダ(/ホーム/ telessaude/telessaude_branch_master)内だ場合/home/telessaude/telessaude_branch_masterdjangoプロジェクトフォルダ以外のフォルダからgunicornを実行するには

に位置しており、このような

gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application --reload --timeout 900

gunicornが始まるなどgunicornのcommanを発行し、だけで動作されます良い。私は(/ホーム/ telessaude)上記1つのディレクトリで同じコマンドを実行しようと...しかし、私は次のエラーを取得する:

[email protected]:~$ gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application --reload --timeout 900 
[2017-03-22 16:39:28 +0000] [10405] [INFO] Starting gunicorn 19.6.0 
[2017-03-22 16:39:28 +0000] [10405] [INFO] Listening at: http://0.0.0.0:8000 (10405) 
[2017-03-22 16:39:28 +0000] [10405] [INFO] Using worker: sync 
[2017-03-22 16:39:28 +0000] [10410] [INFO] Booting worker with pid: 10410 
[2017-03-22 16:39:28 +0000] [10410] [ERROR] Exception in worker process 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 557, in spawn_worker 
    worker.init_process() 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process 
    self.load_wsgi() 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 136, in load_wsgi 
    self.wsgi = self.app.wsgi() 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi 
    self.callable = self.load() 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load 
    return self.load_wsgiapp() 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 
    return util.import_app(self.app_uri) 
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 357, in import_app 
    __import__(module) 
ImportError: No module named telessaude.wsgi_dev 

私も

と私のホームフォルダ内gunicornを実行してみましたgunicorn -w 2 -b 0.0.0.0:8000 telessaude_branch_master.telessaude.wsgi_dev:application --reload --timeout 900

gunicorn -w 2 -b 0.0.0.0:8000 /home/telessaude/telessaude_branch_master/telessaude.wsgi_dev:application --reload --timeout 900

それらのどれも働きました。誰かがこれを修正する方法を教えてもらえますか?私は監督者に「コマンド」パラメータとして追加する必要があるので、どのフォルダからもgunicornを実行する必要があります。

私は仮想環境を使用していません。

答えて

7

コマンドを実行する前に、Gunicornのchdirフラグを使用してプロジェクトディレクトリに変更することができます。

gunicorn -w 2 -b 0.0.0.0:8000 --chdir /home/telessaude/telessaude_branch_master telessaude.wsgi_dev:application --reload --timeout 900 
+0

驚くばかり!ありがとう!!! –

+0

ありがとう! systemdのサービスファイルから適切なコマンドを指定できなかったため、私は立ち往生しました。 --chdirオプションがトリックを作った! – tebanep

関連する問題