python - UAAAAAAH 如何正确使用 uwsgi + Django?
PHP中文网
PHP中文网 2017-04-17 17:32:12
0
1
904

supervisor + uwsgi

*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x24ec4e0 pid: 4274 (default app)
*** uWSGI is running in multiple interpreter mode ***
gracefully (RE)spawned uWSGI master process (pid: 4274)
spawned uWSGI worker 1 (pid: 4348, cores: 1)
spawned uWSGI worker 2 (pid: 4349, cores: 1)
spawned uWSGI worker 3 (pid: 4350, cores: 1)
spawned uWSGI worker 4 (pid: 4351, cores: 1)
Mon Apr  4 11:29:32 2016 - uWSGI worker 1 screams: UAAAAAAH my master disconnected: i will kill myself !!!
Mon Apr  4 11:29:32 2016 - uWSGI worker 2 screams: UAAAAAAH my master disconnected: i will kill myself !!!

执行命令重启

sudo supervisorctl start demo
demo: ERROR (abnormal termination)

uwsgi.log 可能是重启的时候 uwsgi 进程仍在监听该端口

probably another instance of uWSGI is running on the same address (127.0.0.1:8001).
bind(): Address already in use [core/socket.c line 769]

我的配置文件 uwsgi.ini

[uwsgi]
# Django-related settings
chdir           = /home/www/Documents/demo
module          = demo.wsgi:application
env             = DJANGO_SETTINGS_MODULE=demo.settings_production
home            = /home/www/Documents/demo/venv
user            = www
uid             = www
pcre-jit
thunder-lock
enable-threads
master          = true
touch-reload    = /home/www/Documents/demo/reload
processes       = 4
socket          = 127.0.0.1:8001
chmod-socket    = 664
vacuum          = true

supervios conf

[program:vblue]
directory= /home/www/Documents/demo
command = /home/www/Documents/demo/venv/bin/uwsgi --ini /home/www/Documents/demo/uwsgi.ini
autostart=true
autorestart=true
redirect_stderr = true
stdout_logfile = /home/www/Documents/demo/logs/out.log
stdout_logfile_maxbytes = 1MB
stderr_logfile= /home/www/Documents/demo/logs/err.log

不知道怎么用supervisor重启的时候关掉 uwsgi 进行监控, 官方文档只有推荐用 Circus

PHP中文网
PHP中文网

认证0级讲师

Antworte allen(1)
Ty80
pidfile         = /tmp/demo.pid

官方文档是这样去结束他

uwsgi --stop /tmp/demo.pid 
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage