Last active
November 28, 2018 03:46
-
-
Save chiedo/fdf3638850c7d9b7f9d9 to your computer and use it in GitHub Desktop.
Flask uwsgi config
This file contains hidden or 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] | |
socket = 127.0.0.1:5000 | |
threads = 2 | |
master = True | |
chdir = PATH TO YOUR APP | |
# The module entry point for your app. For my purposes, it is project:app | |
module = project:app | |
pythonpath = PATH TO YOUR PYTHON EXECTUABLE | |
pythonpath = PATH TO YOUR APP | |
# Add environment variables. | |
# FLASK | |
env = FLASK_ENV=staging | |
env = FLASK_SECRET_KEY=NONE | |
env = FLASK_CSRF_SESSION_KEY=NONE | |
#MYSQL | |
env = MYSQL_DATABASE=databasename | |
env = MYSQL_USER=username | |
env = MYSQL_PASS=password | |
env = MYSQL_HOSTNAME=localhost | |
env = MYSQL_PORT=3306 | |
logto = /var/log/uwsgi/uwsgi.log | |
gid = www-data | |
uid = www-data | |
# 100 mb. Rather use log rotate to handle log rotation. | |
# log-maxsize = 100000000 | |
# logfile-chown = True | |
#Have a master process | |
master = True | |
pidfile=/tmp/uwsgimaster.pid | |
# Reload when that master process file is touched with touch filename | |
touch-reload=/tmp/uwsgimaster.pid | |
#For new relic | |
enable-threads = True | |
single-interpreter = True | |
# This should make uwsgi restart brutally which may be needed when the server crashes | |
die-on-term = True | |
# More processes | |
processes = 4 | |
# respawn processes taking more than 30 seconds | |
harakiri = 30 | |
# Shoud prevent hikiri for kicking in on uploads | |
post-buffering = True | |
# respawn processes after serving 5000 requests | |
max-requests = 5000 | |
# Enable stats | |
stats = /tmp/uwsgistats.socket | |
# Turn this off for production | |
# catch-exceptions = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment