我开始使用nginx,gunicorn,mysql和超级用户在Django中实现一个webapp,并将pyenv与virtualenv结合使用。我一直在遵循配置Gunicorn的教程,我的shell脚本有如下代码:
NAME="myapp" # Name of the application
DJANGODIR=/home/myapp/myapp # Django project directory
SOCKFILE=/home/myapp/run/gunicorn.sock # we will communicate using this unix socket
USER=myappuser # The user to run as
GROUP=webdata # The group to run as
NUM_WORKERS=3 # How many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=myapp.settings_production # Which settings file should Django use
DJANGO_WSGI_MODULE=myapp.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"
# Activate the virtual environment
cd $DJANGODIR
pyenv activate env
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
exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user $USER \
--bind=unix:$SOCKFILE
问题在于,主管日志输出始终显示:pyenv命令未找到,而exec:gunicorn:未找到,我想这是因为pyenv指令不适用于shell脚本,但是我不知道如何我已修复,任何人都可以帮助我,并向我解释缺少的内容?