Django-Supervisor:退出得太快gunicorn-error.log(ValueError:空模块名称)

时间:2019-01-02 09:13:11

标签: django nginx gunicorn supervisord supervisor

我对编码还很陌生,这是我的第一个部署。我正在按照this指南在digitalocean上进行部署。运行sudo supervisorctl status mhh时出现此错误

Exited too quickly (process log may have details)

log/gunicorn-error.log包含以下内容

[3000] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi=self.app.wsgi()
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable=self.load()
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/victor/local/lib/python2.7/site-packages/gunicorn/utils.py", line 350, in import_app
    __import__(module)
ValueError:Empty module name

这是相关的事件配置

/ home / victor / bin / gunicorn_start

#!/bin/bash

NAME="mhh"
DIR=/home/victor/mhh
USER=victor
GROUP=victor
WORKERS=3
BIND=unix:/home/victor/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=mhh.settings
DJANGO_WSGI_MODULE=mhh.wsgi
LOG_LEVEL=error

cd $DIR
source ../bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH

exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
  --name $NAME \
  --workers $WORKERS \
  --user=$USER \
  --group=$GROUP \
  --bind=$BIND \
  --log-level=$LOG_LEVEL \
  --log-file=-

/etc/supervisor/conf.d/mhh.conf

[program:mhh]
command=/home/victor/bin/gunicorn_start
directory=/home/victor/mhh/mhh
user=victor
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/victor/logs/gunicorn-error.log

0 个答案:

没有答案