기본적으로 제목이 말한 것처럼 노력하고 있습니다. 서버 재시작시에도 장고 응용 프로그램을 계속 실행하려고합니다.감독자 - django 응용 프로그램을 시작하고 bash 파일을 통해 계속 실행하십시오.
나는 약간의 튜토리얼을 따라 갔지만 supervisord가 나를 위해이 작업을 처리하는 데 성공하지 못했다.
나는 현재 보이는, /etc/supervisor/conf.d
에서 MyConf.conf
라는 conf
이 같은 :
[program:MyConf]
command = /home/user/virtualenv/gunicorn_start.bash ; Command to start app
autostart=true ; start app when system starts
autorestart=true ; defines how app starts in event app exits
user=vanew ; User to run as
stdout_logfile=/home/user/virtualenv/nginxConfiguration/error/gunicorn_supervisor.log ; Where to write log messages
stderr_logfile=/home/user/virtualenv/nginxConfiguration/error/gunicorn_supervisor_error.log ; Where to write log error messages
redirect_stderr = true
gunicorn_start.bash 그것은 stdout_logfile
파일에 나에게 아래의 오류를주고 유지
#!/bin/bash
NAME="myapp" # Name of the application
DJANGODIR=/home/useros/virtualenv/MyConf/myapp # Django project directory
#SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=user # the user to run as
GROUP=user # the group to run as
NUM_WORKERS=5 # how many worker processes should Gunicorn
DJANGO_SETTINGS_MODULE=MyConf.settings # which settings file should Django use
DJANGO_WSGI_MODULE=MyConf.wsgi # WSGI module name
echo "Starting $NAME"
# Activate the virtual environment
cd $DJANGODIR
source ../../bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
# Create the run directory if it doesn't exist
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
exec /usr/local/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE
of, 다음 명령을 실행할 때 : sudo supervisorctl start MyConf
:
Starting myapp
dirname: missing operand
Try 'dirname --help' for more information.
2014-06-14 01:20:15 [3698] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
File "/usr/local/bin/gunicorn", line 9, in <module>
load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 71, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 143, in run
Arbiter(self).run()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 172, in run
self.start()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 134, in start
self.LISTENERS = create_sockets(self.cfg, self.log)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/sock.py", line 198, in create_sockets
sock = sock_type(addr, conf, log)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/sock.py", line 102, in __init__
super(UnixSocket, self).__init__(addr, conf, log, fd=fd)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/sock.py", line 31, in __init__
self.sock = self.set_options(sock, bound=(fd is not None))
File "/usr/local/lib/python2.7/dist-packages/gunicorn/sock.py", line 42, in set_options
self.bind(sock)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/sock.py", line 110, in bind
util.chown(self.cfg_addr, self.conf.uid, self.conf.gid)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 157, in chown
os.chown(path, uid, gid)
OSError: [Errno 2] No such file or directory: ''
참고 : 분명히 chmod +x gunicorn_start.bash
뭔가의 파일이나 디렉토리를 찾아 질수으로 실행 gunicorn_start.bash
을 만들어졌다? 이 문제를 어떻게 해결할 수 있습니까?
고맙습니다.