gpt4 book ai didi

python - gunicorn:开始:作业无法启动

转载 作者:太空宇宙 更新时间:2023-11-04 12:51:47 24 4
gpt4 key购买 nike

我在启动我的 gunicorn - 我的服务器上的 Flask 应用程序时遇到问题。

我的服务器是 Ubuntu 14.04 64 位。

当我从终端启动 gunicorn(并激活虚拟环境)时:

gunicorn --bind 0.0.0.0:8000 wsgi

它有效,我可以连接到端口 8000。

但是当我想启动 sudo service MyApp 时,出现以下错误:

start: Job failed to start

我的/etc/init/MyApp.conf 是:

description "Gunicorn application server running MyApp"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid juldou
setgid www-data

env PATH=/home/juldou/MyApp/project_juda/bin
chdir /home/juldou/MyApp
exec gunicorn --workers 3 --bind unix:MyApp.sock -m 007 wsgi

注意:

I know that I don't have created MyApp.sock, I don't know if I must have or this script create MyApp.sock

应该是哪里出了问题?

更新:从终端,此命令正在运行:

(project_juda) juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp$ gunicorn --workers 3 --bind unix:MyApp.sock -m 007 wsgi
[2016-05-01 14:06:41 +0000] [8119] [INFO] Starting gunicorn 19.4.5
[2016-05-01 14:06:41 +0000] [8119] [INFO] Listening at: unix:MyApp.sock (8119)
[2016-05-01 14:06:41 +0000] [8119] [INFO] Using worker: sync
[2016-05-01 14:06:41 +0000] [8124] [INFO] Booting worker with pid: 8124
[2016-05-01 14:06:41 +0000] [8127] [INFO] Booting worker with pid: 8127
[2016-05-01 14:06:41 +0000] [8130] [INFO] Booting worker with pid: 8130
[2016-05-01 14:07:28 +0000] [8119] [INFO] Handling signal: int
[2016-05-01 14:07:28 +0000] [8124] [INFO] Worker exiting (pid: 8124)
[2016-05-01 14:07:28 +0000] [8130] [INFO] Worker exiting (pid: 8130)
[2016-05-01 14:07:28 +0000] [8127] [INFO] Worker exiting (pid: 8127)
[2016-05-01 14:07:28 +0000] [8119] [INFO] Shutting down: Master

auth.log:

May  2 11:16:20 ubuntu-512mb-fra1-01-improveyourself sshd[13991]: 

pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=212.45.1.10 user=www-data
May 2 11:16:22 ubuntu-512mb-fra1-01-improveyourself sshd[13991]: Failed password for www-data from 212.45.1.10 port 39557 ssh2
May 2 11:16:22 ubuntu-512mb-fra1-01-improveyourself sshd[13991]: Received disconnect from 212.45.1.10: 11: Bye Bye [preauth]
May 2 11:16:44 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: reverse mapping checking getaddrinfo for 50-250-218-65-static.hfc.comcastbusiness.net [50.250.218.65] failed - POSSIBLE BREAK-IN ATTEMPT!
May 2 11:16:44 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: Invalid user squid from 50.250.218.65
May 2 11:16:44 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: input_userauth_request: invalid user squid [preauth]
May 2 11:16:44 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: pam_unix(sshd:auth): check pass; user unknown
May 2 11:16:44 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=50.250.218.65
May 2 11:16:46 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: Failed password for invalid user squid from 50.250.218.65 port 48021 ssh2
May 2 11:16:46 ubuntu-512mb-fra1-01-improveyourself sshd[13997]: Received disconnect from 50.250.218.65: 11: Bye Bye [preauth]
May 2 11:16:49 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: reverse mapping checking getaddrinfo for 67-219-227-156.mycomspan.com [67.219.227.156] failed - POSSIBLE BREAK-IN ATTEMPT!
May 2 11:16:49 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: Invalid user wordpress from 67.219.227.156
May 2 11:16:49 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: input_userauth_request: invalid user wordpress [preauth]
May 2 11:16:49 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: pam_unix(sshd:auth): check pass; user unknown
May 2 11:16:49 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=67.219.227.156
May 2 11:16:52 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: Failed password for invalid user wordpress from 67.219.227.156 port 37151 ssh2
May 2 11:16:52 ubuntu-512mb-fra1-01-improveyourself sshd[13999]: Received disconnect from 67.219.227.156: 11: Bye Bye [preauth]

syslog:

May  2 07:17:01 ubuntu-512mb-fra1-01-improveyourself CRON[12670]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 2 08:17:01 ubuntu-512mb-fra1-01-improveyourself CRON[12920]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
May 2 09:17:01 ubuntu-512mb-fra1-01-improveyourself CRON[13174]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
May 2 10:17:01 ubuntu-512mb-fra1-01-improveyourself CRON[13473]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
May 2 11:05:55 ubuntu-512mb-fra1-01-improveyourself kernel: [167847.860083] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:07:02 ubuntu-512mb-fra1-01-improveyourself kernel: [167915.147641] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:07:12 ubuntu-512mb-fra1-01-improveyourself kernel: [167925.023643] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:07:50 ubuntu-512mb-fra1-01-improveyourself kernel: [167963.214775] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:15:49 ubuntu-512mb-fra1-01-improveyourself kernel: [168442.437658] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:16:29 ubuntu-512mb-fra1-01-improveyourself kernel: [168481.799393] init: Failed to spawn MyApp main process: unable to execute: No such file or directory
May 2 11:17:01 ubuntu-512mb-fra1-01-improveyourself CRON[14004]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)

UPDATE:

(project_juda) juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp/project_juda/bin$ ls
MyApp.sock activate activate.fish easy_install markdown_py pip3 pwiz.py python python3 wheel
__pycache__ activate.csh activate_this.py easy_install-3.4 pip pip3.4 pygmentize python-config python3.4
(project_juda) juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp/project_juda/bin$ deactivate
juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp/project_juda/bin$ gun
gunicorn gunicorn_django gunicorn_paster gunzip
juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp/project_juda/bin$ gunicorn --workers 3 --bind unix:MyApp.sock -m 007 wsgi
[2016-05-02 11:44:31 +0000] [14195] [INFO] Starting gunicorn 19.4.5
[2016-05-02 11:44:31 +0000] [14195] [INFO] Listening at: unix:MyApp.sock (14195)
[2016-05-02 11:44:31 +0000] [14195] [INFO] Using worker: sync
[2016-05-02 11:44:31 +0000] [14200] [INFO] Booting worker with pid: 14200
[2016-05-02 11:44:31 +0000] [14200] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, 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 wsgi
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, 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 wsgi
[2016-05-02 11:44:31 +0000] [14200] [INFO] Worker exiting (pid: 14200)
[2016-05-02 11:44:31 +0000] [14195] [INFO] Shutting down: Master
[2016-05-02 11:44:31 +0000] [14195] [INFO] Reason: Worker failed to boot.

最佳答案

我觉得行

chdir /home/juldou/MyApp

不会将目录更改为 wsgi 所在的位置。

尝试将 /home/juldou/MyApp 更改为您可以从终端运行它的路径。

关于python - gunicorn:开始:作业无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36966692/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com