2017-03-22 3 views
0

하지 않은 폴더에서 gunicorn 실행하는 방법의이 /home/telessaude를 호출 할 수 있습니다. 그래서 프로젝트 루트 내가 장고 프로젝트 홈 폴더 (/ 홈/telessaude/telessaude_branch_master)의 내부입니다 경우 /home/telessaude/telessaude_branch_master내 홈 폴더에서 프로젝트를 복제 이눔 장고 프로젝트 폴더

에 위치하고 있으며 gunicorn의 령 어를 발행 등

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

gunicorn 시작을 그냥 작동합니다 벌금. 그러나 ... 나는 (/ 홈/telessaude) 위의 하나의 디렉토리에 동일한 명령을 실행하려고하면, 나는 다음과 같은 오류 얻을 :

[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