尝试在VPS上为Django应用程序配置Supervisor时出现此错误。因此,当我查看错误日志时,似乎找不到目录,但是我不知道自己在做什么错。
路径为:
/ home / webconexus / portfolio
(portfolio) webconexus@wagtail-portfolio:~/portfolio$ sudo supervisorctl status
portfolio FATAL Exited too quickly (process log may have details
这是我的gunicorn_start文件:
#!/bin/bash
NAME="portfolio"
DIR=/home/webconexus/portfolio
USER=webconexus
GROUP=webconexus
WORKERS=3
BIND=unix:/home/webconexus/portfolio/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=portfolio.settings
DJANGO_WSGI_MODULE=portfolio.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=-
这是我的conf文件:
[program:portfolio]
command=/home/webconexus/portfolio/bin/gunicorn_start
directory=/home/webconexus/portfolio
user=webconexus
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/webconexus/portfolio/logs/gunicorn-error.log
新的错误日志:
[2019-02-07 12:58:20 +0000] [3835] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
ImportError: No module named 'portfolio'
答案 0 :(得分:0)
无需返回到..
尝试
#!/bin/bash
NAME="portfolio"
DIR=/home/webconexus/portfolio
USER=webconexus
GROUP=webconexus
WORKERS=3
BIND=unix:/home/webconexus/portfolio/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=portfolio.settings
DJANGO_WSGI_MODULE=portfolio.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=-
答案 1 :(得分:0)
应用Nagesh答案后的新回溯:
[2019-02-07 12:58:20 +0000] [3835] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
ImportError: No module named 'portfolio'