Skip to content

Commit

Permalink
Update readme, add gunicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
secsilm committed Mar 1, 2020
1 parent 6bff79c commit 780696a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ __pycache__/
app.out
.ipynb_checkpoints/
run.pid
log/
config.py
log/*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ pip install -r requirements.txt
python app.py
```

or using gunicorn:

```bash
gunicorn -c config.py app:server
```

Then open http://locahost:8150 or http://{*your_ip*}:8150 in your browser. Bazinga!

## Field description
Expand Down
6 changes: 6 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ pip install -r requirements.txt
python app.py
```

也可以使用 gunicorn 启动:

```bash
gunicorn -c config.py app:server
```

然后在浏览器中打开 http://locahost:8150 或者 http://{*your_ip*}:8150。Bazinga!

## 字段说明
Expand Down
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from utils import get_infos

app = dash.Dash(__name__)
server = app.server

table_columns = [
"gpu",
Expand Down Expand Up @@ -75,7 +76,7 @@ def convert_to_df(info):
df["gpu"] = dids
result.append(df)
result = pd.concat(result, sort=False)
result = result[table_columns]
result = result.loc[:, table_columns]
result.create_time = result.create_time.map(timestamp2datetime)
for c in int_columns:
result[c] = result[c].astype(int)
Expand Down
10 changes: 10 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
workers = 1
bind = '0.0.0.0:8150'
worker_class = 'gevent'
worker_connections = 1500
timeout = 60
loglevel = 'info'
accesslog = "log/gunicorn_access.log"
errorlog = "log/gunicorn_error.log"
daemon = True
pidfile = "gunicorn.pid"

0 comments on commit 780696a

Please sign in to comment.