Setuping flask with gunicorn, supervisord, nginx Python 03.10.2015

Flask application

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.
from flask import Flask, render_template

DEBUG = True
SECRET_KEY = '_secret_'

app = Flask(__name__)
app.config.from_object(__name__)

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    app.run()

nginx configuration file

Nginx is a web server with a strong focus on high concurrency, performance and low memory usage.
server {
    server_name something.ua www.something.ua;

    location / {
        proxy_pass http://unix:/home/www/something/run/block.socket;
        include /etc/nginx/proxy.conf;        
    }

    location /static {
        root /home/www/something/app;
        expires 24h;
    }
}

supervisord configuration file

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
[program:something]
command=/home/www/.virtualenvs/something/bin/gunicorn -c /home/www/something/conf/gunicorn.conf.py --chdir /home/www/something/app wsgi:app
directory=/home/www/something/app
user=www
group=www
autostart=True
autorestart=True
redirect_stderr=True
daemon = False
debug = False
stdout_logfile=/home/www/something/logs/supervisor.log
loglevel = "info"
environment = PYTHON_EGG_CACHE="/home/www/something/.python-eggs"

wsgi.py file

from app import app

if __name__ == "__main__":
    app.run()

gunicorn configuration file

Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX.
bind = "unix:/home/www/something/run/block.socket"
workers = 2
logfile = "/home/www/something/logs/gunicorn.log"
loglevel = "warning"
proc_name = "something"
daemon = False
debug = False
user="www"