Skip to content

Instantly share code, notes, and snippets.

@manelclos
Last active August 1, 2017 10:06
Show Gist options
  • Save manelclos/390c2bc28cbd6279e234 to your computer and use it in GitHub Desktop.
Save manelclos/390c2bc28cbd6279e234 to your computer and use it in GitHub Desktop.
uwsgi ondemand config
[uwsgi]
procname-prefix-spaced=/apps/%c
chdir = %d/app
need-app = true
touch-reload = %d/uwsgi.ini
# old way
# module = wsgi
# new way
mount = /apps/appname=djangoapp/wsgi.py
manage-script-name = true
# set enviroment variables from ini file.
# http://stackoverflow.com/a/23733905/593907
for-readline = %d/vars.ini
env = %(_)
endfor =
# define if needed
# venv = %d/env
# execution
# on-demand instances don't need to create the socket, the emperor will do
# socket = %d/uwsgi.sock
workers = 1
threads = 5
max-requests = 1000
cheap
idle = 60
die-on-idle = true
# logging
logto = %d/log.log
log-date = true
logfile-chown = true
log-backupname = %d/log.log.old
log-maxsize = 2500000
# system
uid = www-data
gid = www-data
buffer-size = 32768
master = true
chmod = 660
auto-procname = true
no-orphans = true
vacuum = true
die-on-term = true
DB_user=foo
DB_PASSWORD=bar
#! /bin/sh
#
# how can I turn config ini file into system environment in bash?
#
# credits: http://stackoverflow.com/a/22535251/593907
#
set -a # turn on automatic export
source vars.ini # execute all commands in the file
set +a # turn off automatic export
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment