我的 supervisor.conf 如下:
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
username=user ; should be same as http_username if set
password=123 ; should be same as http_password if set
[include]
files =ci_ios/webhook/wsgi.py
[program:wsgi]
command=~/Documents/supervisor/env/bin/gunicorn --chdir ~/Documents/supervisor
/ci_ios/webhook -b 0.0.0.0:8000 wsgi:application
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=true
stdout_logfile=/tmp/gunicorn.log
stderr_logfile=/tmp/gunicorn.err
然后我直接启动命令,~/Documents/supervisor/env/bin/gunicorn --chdir ~/Documents/supervisor/ci_ios/webhook -b 0.0.0.0:8000 wsgi:application
,
没有报错,可以正常启动:
Starting gunicorn 19.6.0
[2016-12-29 15:23:45 +0800] [35578] [INFO] Listening at: http://0.0.0.0:8000 (35578)
[2016-12-29 15:23:45 +0800] [35578] [INFO] Using worker: sync
[2016-12-29 15:23:45 +0800] [35581] [INFO] Booting worker with pid: 35581
^C[2016-12-29 15:23:54 +0800] [35578] [INFO] Handling signal: int
[2016-12-29 15:23:54 +0800] [35581] [INFO] Worker exiting (pid: 35581)
但是我通过supervisord -c supervisor.conf
就会报错:
Error: File contains no section headers.
file: /Users/djx/Documents/supervisor/ci_ios/webhook/wsgi.py, line: 2
'from __future__ import with_statement\n'
For help, use /Users/djx/Documents/supervisor/env/bin/supervisord -h
可是谷歌了半天也不知到底该怎么改,我保存的 py 格式是 UTF-8 无 BOM 。
还有我的项目目录的结构是
~/Documents/supervisor/
ci_ios/webhook/wsgi.py
supervisor.conf
希望大神赶快出现,我实在无力解决。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.