暴发户 Gunicorn 不工作

Upstart Gunicorn doesn't working

大家好,我是韩国学生:)

我正在使用 nginx、gunicorn 研究分期、生产测试

首先我想要 运行 gunicorn 使用套接字

gunicorn --bind unix:/tmp/tddtest.com.socket testlists.wsgi:applicaion

它显​​示

[2016-06-26 05:33:42 +0000] [27861] [INFO] Starting gunicorn 19.6.0
[2016-06-26 05:33:42 +0000] [27861] [INFO] Listening at:  unix:/tmp/tddgoat1.amull.net.socket (27861)
[2016-06-26 05:33:42 +0000] [27861] [INFO] Using worker: sync
[2016-06-26 05:33:42 +0000] [27893] [INFO] Booting worker with pid: 27893

我运行正在本地存储库中测试功能

python manage.py test func_test

我在工作!

Creating test database for alias 'default'...
..
----------------------------------------------------------------------
Ran 2 tests in 9.062s

OK
Destroying test database for alias 'default'...

并且我希望在启动服务器时自动启动 gunicorn

所以我决定使用 Upstart(in ubuntu)

/etc/init/tddtest.com.conf

description "Gunicorn server for tddtest.com"

start on net-device-up
stop on shutdown

respawn

setuid elspeth
chdir /home/elspeth/sites/tddtest.com/source/TDD_Test/testlists/testlists

exec gunicorn --bind \ unix:/tmp/tdd.com.socket testlists.wsgi:application

(wsgi.py的路径是)

/sites/tddtest.com/source/TDD_Test/testlists/testlists

我命令

sudo start tddtest.com

显示

tddtest.com start/running, process 27905

我认为它有效

但是我运行正在本地存储库中测试功能

python manage.py test func_test

但它显示

======================================================================
FAIL: test_can_start_a_list_and_retrieve_it_later (functional_tests.tests.NewVisitorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/Users/hanminsoo/Documents/TDD_test/TDD_Test/superlists/functional_tests/tests.py", line 38, in test_can_start_a_list_and_retrieve_it_later
self.assertIn('To-Do', self.browser.title)
AssertionError: 'To-Do' not found in 'Error'

----------------------------------------------------------------------
Ran 2 tests in 4.738s

GUNICORN 不工作ㅠ_ㅠ

我要看过程

ps aux

但是我找不到 gunicorn 进程

[...]
ubuntu   24387  0.0  0.1 105636  1700 ?        S    02:51   0:00     sshd: ubuntu@pts/0
ubuntu   24391  0.0  0.3  21284  3748 pts/0    Ss   02:51   0:00 -bash
root     24411  0.0  0.1  63244  1800 pts/0    S    02:51   0:00 su -     elspeth
elspeth  24412  0.0  0.4  21600  4208 pts/0    S    02:51   0:00 -su
root     26860  0.0  0.0  31088   960 ?        Ss   04:45   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody   26863  0.0  0.1  31524  1872 ?        S    04:45   0:00 nginx: worker process
elspeth  28005  0.0  0.1  17160  1292 pts/0    R+   05:55   0:00 ps aux

我找不到问题...

请有人帮助我谢谢:)

请修改您的upstart脚本如下:

exec /home/elspeth/.pyenv/versions/3.5.1/envs/sites/bin/gunicorn --bind \ unix:/tmp/tdd.com.socket testlists.wsgi:application

如果这不起作用,很可能是因为 /home/elspeth/.pyenv/ 文件夹无法访问,请检查其权限。如果发现权限是正确的并且您仍然遇到问题,请尝试以下操作:

script
   cd /home/elspeth/sites/tddtest.com/source/TDD_Test/testlists/testlists
   /home/elspeth/.pyenv/versions/3.5.1/envs/sites/bin/gunicorn --bind \ unix:/tmp/tdd.com.socket testlists.wsgi:application

end script