Question

How to configure gunicorn (and make sense out of it)

Posted October 31, 2019 426 views
Django

I have cloned my git repo in :here

/var/www/directoriovirtual/here

then I have created a gunicorn_start file inside: directoriovirtual

the gunicorn_start file reads:

NAME=“djangovideos”
DIR=/var/www/directoriovirtual/languaget
USER=user
videos
GROUP=videos
WORKERS=3
BIND=unix:/var/www/run/gunicorn.sock
DJANGOSETTINGSMODULE=tutoriales.settings
DJANGOWSGIMODULE=tutoriales.wsgi
LOG_LEVEL=error

cd $DIR
source ../directoriovirtual/bin/activate

export DJANGOSETTINGSMODULE=$DJANGOSETTINGSMODULE
export PYTHONPATH=$DIR:$PYTHONPATH

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

I have tried to test whether it works but very unsure of what I am doing:

sudo systemctl status gunicorn

and the dreaded answer goes:

Unit gunicorn.service could not be found.

The domain shows nginx is working, now I was trying to add gunicorn and then supervisor but kind of lost at this point.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer
Submit an Answer