Created
August 25, 2018 18:47
-
-
Save sumitsk20/3fd695be31bf3ed0a7f3e388888c012c to your computer and use it in GitHub Desktop.
uwsgi configuration file for scaling django website. I have included most widely used options that you may want to configure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
# name of project you during "django-admin startproject <name>" | |
project_name = updateMe | |
# just a directory name i use for different server deployment | |
branch = develop | |
# building base path to where project directory is present [In my case this dir is also where my virtual env is] | |
base_dir = /home/ubuntu/webapps/%(project_name)/%(branch) | |
# set PYTHONHOME/virtualenv or setting where my virtual enviroment is | |
virtualenv = %(base_dir) | |
# changig current directory to project directory where manage.py is present | |
chdir = %(base_dir)/src/ | |
# loading wsgi module | |
module = %(project_name).wsgi:application | |
# enabling master process with n numer of child process | |
master = true | |
processes = 4 | |
# enabling multithreading and assigning threads per process | |
# enable-threads = true | |
# threads = 2 | |
# Bind to the specified socket using default uwsgi protocol. | |
uwsgi-socket = %(base_dir)/run/%(project_name).sock | |
# set the UNIX sockets’ permissions to access | |
chmod-socket = 660 | |
# Set internal sockets timeout in seconds. | |
socket-timeout = 300 | |
# Set the maximum time (in seconds) a worker can take to reload/shutdown. | |
reload-mercy = 8 | |
# Reload a worker if its address space usage is higher than the specified value (in megabytes). | |
reload-on-as = 512 | |
# respawn processes taking more than 50 seconds | |
harakiri = 50 | |
# respawn processes after serving 5000 requests | |
max-requests = 5000 | |
# clear environment on exit | |
vacuum = true | |
# When enabled (set to True), only uWSGI internal messages and errors are logged. | |
disable-logging = True | |
# path to where uwsgi logs will be saved | |
logto = %(base_dir)/log/uwsgi.log | |
# maximum size of log file 20MB | |
log-maxsize = 20971520 | |
# Set logfile name after rotation. | |
log-backupname = %(base_dir)/log/old-uwsgi.log | |
# Reload uWSGI if the specified file or directory is modified/touched. | |
touch-reload = %(base_dir)/src/ | |
# Set the number of cores (CPUs) to allocate to each worker process. | |
# cpu-affinity = 1 | |
# Reload workers after this many seconds. Disabled by default. | |
max-worker-lifetime = 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment