9 - Setting up Gunicorn - Deploying a Django Project - Ubuntu

You need to be subscribed to a plan to get access to the full course.

Gunicorn is one of the web servers we're going to use. Let's set it up!

Comments

Eric H | May 11, 23 01:21

Hey there. Great lesson! Just FYI - My script for launching gunicorn needed #!/bin/bash as the first line for the shell specification instead of #!/bin/sh in order to run properly.


Stein Ove Helset | May 20, 23 06:31

Ah, nice to know :-)

Eric H | May 11, 23 01:27

My paths are a bit wonky (my Django is a bit deeper in my directory structure) but here's an example template for those that need something to copy into their gunicorn_start. I've never used gunicorn and this lesson was a huge help!

#!/bin/bash

NAME='studynet'
DJANGODIR=/webapps/lms/vue-django-lms/studynet_django
SOCKFILE=/webapps/lms/lms_env/run/gunicorn.sock
USER=lmsuser
GROUP=webapps
NUM_WORKERS=3
DJANGO_SETTINGS_MODULE=studynet_django.settings
DJANGO_WSGI_MODULE=studynet_django.wsgi
TIMEOUT=120

cd $DJANGODIR
source ../../../lms_env/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH

RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

exec /webapps/lms/lms_env/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--timeout $TIMEOUT \
--user=$USER \
--group=$GROUP \
--bind=unix:$SOCKFILE \
--log-level=debug \
--log-file=-


Stein Ove Helset | May 20, 23 06:31

Yes, it can sometimes be a little bit different from server to server and similar. But once you've done it a couple of times, you will get the hang of it :-D

Giulio Nazzaro | Jan 11, 25 10:10

Part 9 video - Setting up gunicorn doesn't start ...

EFSArCBy | Jul 02, 26 09:40

555

EFSArCBy | Jul 02, 26 09:48

555

EFSArCBy | Jul 02, 26 09:48

555

EFSArCBy | Jul 02, 26 09:49

-1 OR 2+65-65-1=0+0+0+1 --

EFSArCBy | Jul 02, 26 09:49

-1 OR 2+805-805-1=0+0+0+1

EFSArCBy | Jul 02, 26 09:49

-1' OR 2+782-782-1=0+0+0+1 --

EFSArCBy | Jul 02, 26 09:49

-1' OR 2+245-245-1=0+0+0+1 or 'Jr7itvE6'='

EFSArCBy | Jul 02, 26 09:49

-1" OR 2+827-827-1=0+0+0+1 --

EFSArCBy | Jul 02, 26 09:49

555*if(now()=sysdate(),sleep(15),0)

EFSArCBy | Jul 02, 26 09:49

5550'XOR(555*if(now()=sysdate(),sleep(15),0))XOR'Z

EFSArCBy | Jul 02, 26 09:49

5550"XOR(555*if(now()=sysdate(),sleep(15),0))XOR"Z

EFSArCBy | Jul 02, 26 09:49

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

EFSArCBy | Jul 02, 26 09:49

555-1; waitfor delay '0:0:15' --

EFSArCBy | Jul 02, 26 09:49

555-1); waitfor delay '0:0:15' --

EFSArCBy | Jul 02, 26 09:49

555-1 waitfor delay '0:0:15' --

EFSArCBy | Jul 02, 26 09:49

555buXbhvtW'; waitfor delay '0:0:15' --

EFSArCBy | Jul 02, 26 09:49

555-1 OR 673=(SELECT 673 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

555-1) OR 570=(SELECT 570 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

555-1)) OR 460=(SELECT 460 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

555pQ0eDbxI' OR 100=(SELECT 100 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

555nlMoLZ5k') OR 664=(SELECT 664 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

5556vCcb3u5')) OR 476=(SELECT 476 FROM PG_SLEEP(15))--

EFSArCBy | Jul 02, 26 09:49

555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

EFSArCBy | Jul 02, 26 09:49

555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555'"

EFSArCBy | Jul 02, 26 09:49

@@Ji6PQ

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

-1 OR 2+542-542-1=0+0+0+1 -- | Jul 02, 26 09:49

555

-1 OR 2+168-168-1=0+0+0+1 | Jul 02, 26 09:49

555

-1' OR 2+600-600-1=0+0+0+1 -- | Jul 02, 26 09:49

555

-1' OR 2+330-330-1=0+0+0+1 or 'k3AjeOhf'=' | Jul 02, 26 09:49

555

-1" OR 2+894-894-1=0+0+0+1 -- | Jul 02, 26 09:49

555

if(now()=sysdate(),sleep(15),0) | Jul 02, 26 09:49

555

EFSArCBy0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z | Jul 02, 26 09:49

555

EFSArCBy0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z | Jul 02, 26 09:49

555

EFSArCBy-1 waitfor delay '0:0:15' -- | Jul 02, 26 09:49

555

EFSArCBy4sfjq7aJ'; waitfor delay '0:0:15' -- | Jul 02, 26 09:49

555

EFSArCByog1AYDBy' OR 654=(SELECT 654 FROM PG_SLEEP(15))-- | Jul 02, 26 09:49

555

EFSArCBy9jNSD65v') OR 594=(SELECT 594 FROM PG_SLEEP(15))-- | Jul 02, 26 09:49

555

EFSArCBy5WSN28Xr')) OR 587=(SELECT 587 FROM PG_SLEEP(15))-- | Jul 02, 26 09:49

555

EFSArCBy'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||' | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy'" | Jul 02, 26 09:49

555

@@MYaBa | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

EFSArCBy | Jul 02, 26 09:49

555

Add comment

Info

Please log in to comment!

Newsletter

Subscribe to my weekly newsletter. One time per week I will send you a short summary of the tutorials I have posted in the past week.