pip install gunicorn
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_pivottable
from data import data
app = dash.Dash(__name__)
server = app.server
app.title = 'My Dash example'
app.layout = html.Div([
dash_pivottable.PivotTable(
id='table',
data=data,
cols=['Day of Week'],
colOrder="key_a_to_z",
rows=['Party Size'],
rowOrder="key_a_to_z",
rendererName="Grouped Column Chart",
aggregatorName="Average",
vals=["Total Bill"],
valueFilter={'Day of Week': {'Thursday': False}}
),
html.Div(
id='output'
)
])
@app.callback(Output('output', 'children'),
[Input('table', 'cols'),
Input('table', 'rows'),
Input('table', 'rowOrder'),
Input('table', 'colOrder'),
Input('table', 'aggregatorName'),
Input('table', 'rendererName')])
def display_props(cols, rows, row_order, col_order, aggregator, renderer):
return [
html.P(str(cols), id='columns'),
html.P(str(rows), id='rows'),
html.P(str(row_order), id='row_order'),
html.P(str(col_order), id='col_order'),
html.P(str(aggregator), id='aggregator'),
html.P(str(renderer), id='renderer'),
]
if __name__ == '__main__':
app.run_server(debug=True)
workers = 4
threads = 2
bind = '127.0.0.1:8050'
daemon = 'false'
worker_class = 'gevent'
worker_connections = 200
pidfile = '/var/run/gunicorn.pid'
assesslog = '/var/log/gunicorn_access.log'
errorlog = '/var/log/gunicorn_error.log'
loglevel = 'warning'
gunicorn -c xxx.conf app:server
gunicorn -w 4 -b 0.0.0.0:8050 app:server
-w表示进程数量
nohup gunicorn -w 4 -b 0.0.0.0:8050 app:server &