우분투 12.04 시스템에서 관리자로부터 Gunicorn을 실행하려고합니다. Gunicorn은 Flask 앱 (Flask의 임베디드 서버로 테스트 한 간단한 REST 웹 서비스)을 실행합니다. Gunicorn 서버를 설치하기 때문에 GIT repo를 clonning하여 'apt-get install'을 피하려고했습니다. 나는 그것을 실행하고 싶지 않습니다, 그것은 감독자에 의해서만 실행됩니다.관리자가 Gunicorn + Flask와 함께 작동하지 않습니다.
cd /usr/local/bin
gunicorn my_app:app -c /path/to/gu_config_file
Gunicorn 작동 : 내가하려고하면
그래서 후, 설치합니다. 그럼 나는 그것을 죽인다. '.py'확장자는 나를 위해 작동하지 않기 때문에 확장자가없는 설정 파일을주의하십시오. Supervisor에서
[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
및 업데이트 변경 : 그래서 내가 좋아하는 감독자의 config 파일을 편집
supervisorctl reread
# gunicorn: changed
supervisorctl update
# gunicorn: stopped
# gunicorn: updated process group
파일에 변화를 감지하고 Gunicorn 프로그램 작동합니다. 좋아,하지만 나는 그것을 시작하려고 :
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/
그러나 작동하지 않았다.
편집 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/지방/lib 디렉토리/프로젝트에
예, 저도 답장을 보내면서 제 질문을 편집 중입니다 ... 죄송합니다. 나는 네가 한 말을하고있다. :) –
그래서 'const'모듈을 찾을 수 없다는 것을 알려주지 만, 관리자의 설정 파일에 환경에 추가 된/usr/local/lib/project에 있습니다. –
gunicorn에 경로를 직접 전달하는 것에 대한 편집을 참조하십시오. – robertklep