Gunicorn with Django

While searching for deploying the Django app, I found something called Gunicorn.
I tried:

gunicorn sage.wsgi

where sage is the name of the Django project. And now the django app can be accessed from the default address.

To make it automatic, I had to do some tweaks like creating file in /etc/init and creating its symlink in /etc/init.d/ etc.

Here is the file civiloctave.conf in the folder /etc/init :

description "civiloctave"
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 5

LOGDIR=$(dirname $LOGFILE)
test -d $LOGDIR || mkdir -p $LOGDIR
cd /home/mandeep/CivilOctave/$NAME
gunicorn sage.wsgi

exec /home/mandeep/CivilOctave/$NAME/ \
--user=$USER --group=$GROUP --log-level=debug \
--name=$NAME -b$PORT \
--log-file=$LOGFILE 2>>$LOGFILE
end script


After creating its symlink in /etc/init.d/ and rebooting, the process starts itself and then we can open the address (i.e. localhost:8000) anytime in the browser to see it working. I couldn’t get it working through apache. I’ll get on that later on.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close