python – 部署Django,supervisorctl异常终止

我正在尝试部署django.所以在干净的VPS中安装了所有东西.我能够使用独角兽运行服务器,但我正在尝试使用supervisord.所以我像过去一样遵循this教程,但现在当我使用sudo supervisorctl启动uniprogress启动应用程序时,我收到错误说明uniprogress:ERROR(异常终止).您可以在下面找到日志文件.

文件:/opt/myapps/logs/gunicorn_supervisor.log

Starting uniprogress as uniusr
2014-04-24 04:54:30 [18053] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
  File "/opt/myapps/uniprogress/../bin/gunicorn", line 9, in <module>
    load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
    Arbiter(self).run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
    self.start()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 134, in start
    self.LISTENERS = create_sockets(self.cfg, self.log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 198, in create_sockets
    sock = sock_type(addr, conf, log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 99, in __init__
    os.remove(addr)
OSError: [Errno 13] Permission denied: '/opt/myapps/run/gunicorn.sock'
Starting uniprogress as uniusr
2014-04-24 04:54:31 [18064] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
  File "/opt/myapps/uniprogress/../bin/gunicorn", line 9, in <module>
    load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
    Arbiter(self).run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
    self.start()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 134, in start
    self.LISTENERS = create_sockets(self.cfg, self.log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 198, in create_sockets
    sock = sock_type(addr, conf, log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 99, in __init__
    os.remove(addr)
OSError: [Errno 13] Permission denied: '/opt/myapps/run/gunicorn.sock'
Starting uniprogress as uniusr
2014-04-24 04:54:31 [18064] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
  File "/opt/myapps/uniprogress/../bin/gunicorn", line 9, in <module>
    load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
    Arbiter(self).run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
    self.start()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 134, in start
    self.LISTENERS = create_sockets(self.cfg, self.log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 198, in create_sockets
    sock = sock_type(addr, conf, log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 99, in __init__
    os.remove(addr)
OSError: [Errno 13] Permission denied: '/opt/myapps/run/gunicorn.sock'
Starting uniprogress as uniusr
2014-04-24 04:54:34 [18075] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
  File "/opt/myapps/uniprogress/../bin/gunicorn", line 9, in <module>
    load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
    Arbiter(self).run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
    self.start()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 134, in start
    self.LISTENERS = create_sockets(self.cfg, self.log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 198, in create_sockets
    sock = sock_type(addr, conf, log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 99, in __init__
    os.remove(addr)
OSError: [Errno 13] Permission denied: '/opt/myapps/run/gunicorn.sock'
Starting uniprogress as uniusr
2014-04-24 04:54:37 [18086] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
  File "/opt/myapps/uniprogress/../bin/gunicorn", line 9, in <module>
    load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
    Arbiter(self).run()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
    self.start()
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 134, in start
    self.LISTENERS = create_sockets(self.cfg, self.log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 198, in create_sockets
    sock = sock_type(addr, conf, log)
  File "/opt/myapps/local/lib/python2.7/site-packages/gunicorn/sock.py", line 99, in __init__
    os.remove(addr)
OSError: [Errno 13] Permission denied: '/opt/myapps/run/gunicorn.sock'

解决方法:

问题是用户uniusr没有权限写入/ opt / myapps.所以我为了解决这个问题所做的是以下内容.

sudo chown -R uniusr:users /opt/myapps
sudo chmod -R g+w /opt/myapps
上一篇:Django + Gunicorn + Nginx 部署之路


下一篇:python – 在Django / Gunicorn应用程序中拥有持久(非deamon)线程的危险?