I would like to deploy an app with gunicorn and supervisor, but I face a problem when I run sudo supervisorctl restart febPy
(app name).
I get an error ERROR (spawn error)
and when I go to the gunicorn_errors file, I get the following logs:
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 3: NAME: not found
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 4: DIR: not found
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 13: source: not found
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: argument -n/--name: expected one argument
gunicorn_configuration:
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 3: NAME: not found
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 4: DIR: not found
/home/ubuntu/febPy/venv/bin/gunicorn_configuration: 13: source: not found
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: argument -n/--name: expected one argument
Вы отправили
DIR = /home/ubuntu/febPy/eshop #Directory where project is located
USER=ubuntu #User to run this script as
GROUP=ubuntu #Group to run this script as
WORKERS=3 #Nmber of workers that GUnicorn should spawn
SOCKFILE=unix:/home/ubuntu/febPy/eshop/gunicorn.sock #Which WSGI file should use
DJANGO_SETTINGS_MODULE=eshop/settings #Which Django settings file should use
DJANGO_WSGI_MODULE=eshop.wsgi #Which WSGI file should use
LOG_LEVEL=debug
cd $DIR
source /home/ubuntu/febPy/venv/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH
#Command to run the progam under supervisor
exec /home/ubuntu/febPy/venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$SOCKFILE \
--log-level=$LOG_LEVEL \
--log-file=-