Skip to content

Instantly share code, notes, and snippets.

@vandorjw
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save vandorjw/6795d03c3ffe2554738d to your computer and use it in GitHub Desktop.

Select an option

Save vandorjw/6795d03c3ffe2554738d to your computer and use it in GitHub Desktop.
uWSGI vassal file
# Using TCP-Sockets
[uwsgi]
projectname = com_example_www
base = /srv/site/com/example/www
chdir = %(base)/src/%(projectname)
pythonpath = %(base)/src/%(projectname)
virtualenv = %(base)/venv/%(projectname)
disable-logging = true
logto = %(base)/logs/uwsgi.log
env = DJANGO_SETTINGS_MODULE=%(projectname).settings
module = django.core.wsgi:get_wsgi_application()
plugin = python
http-socket = 127.0.0.1:9000
@vandorjw
Copy link
Copy Markdown
Author

FILE: /etc/init.d/uwsgi-emperor

Function that starts the daemon/service with a small edit

-----------

do_start()
{

Return

0 if daemon has been started

1 if daemon was already running

2 if daemon could not be started

if [ "$ENABLED" != yes ]; then
[ "$VERBOSE" != no ] && log_progress_msg "(disabled; see /etc/default/uwsgi-emperor)"
return 2
fi

Assure that /var/run/uwsgi-emperor directory exists

[ -d /run/uwsgi-emperor ] || mkdir -p /run/uwsgi-emperor

Make the socket directory files writable by uwsgi-emperor

chown "www-data" /run/uwsgi-emperor

start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --
$DAEMON_ARGS 1> /dev/null 2>&1
|| return 2
}

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