Skip to content

Instantly share code, notes, and snippets.

@Nipun2016
Created June 27, 2019 07:16
Show Gist options
  • Save Nipun2016/59633e1326f9943f124aad8890bf89cb to your computer and use it in GitHub Desktop.
Save Nipun2016/59633e1326f9943f124aad8890bf89cb to your computer and use it in GitHub Desktop.
#!/bin/bash
NAME="Socket_app" # Name of the application
DJANGODIR= Your project directory
SOCKFILE=Location of the socket file
USER=ubuntu # the user to run as
GROUP=ubuntu # the group to run as
NUM_WORKERS=1 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=Socket_app.settings # which settings file should Djangouse
DJANGO_WSGI_MODULE=Socket_app.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"
# Activate the virtual environment
cd $DJANGODIR
source /home/ubuntu/webapps/backend/env/bin/activate #activate file location of your environment
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
# Create the run directory if it doesn't exist
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
# below mention code creates a single process that will handle multiple connection with multiple threads
exec gunicorn -k eventlet ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--bind=0.0.0.0:8000 \
--threads=1000 \
--log-level=debug \
--log-file=-
@kaizen-cmd
Copy link

where do i find this in windows ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment