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

October 31, 2019 66 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.

1 Answer

UPDATE>

It is solved.

Have another answer? Share your knowledge.