tldr/pages.zh/osx/gunicorn.md

28 lines
649 B
Markdown
Raw Normal View History

2019-02-26 03:13:29 +00:00
# gunicorn
2019-10-18 04:30:29 +01:00
> Python 的 WSGI http 服务器.
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 运行 python web 应用程序:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn {{导入路径:应用程序}}`
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 在 localhost 上监听 8080 端口:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn --bind {{localhost}}:{{8080}} {{导入路径:应用程序}}`
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 启用实时自动加载:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn --reload {{导入路径:应用程序}}`
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 使用 4 个工作进程处理请求:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn --workers {{4}} {{导入路径:应用程序}}`
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 使用 4 个工作线程处理请求:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn --threads {{4}} {{导入路径:应用程序}}`
2019-02-26 03:13:29 +00:00
2019-10-19 07:12:27 +01:00
- 通过 https 运行应用程序:
2019-02-26 03:13:29 +00:00
2019-10-18 03:33:27 +01:00
`gunicorn --certfile {{cert.pem}} --keyfile {{key.pem}} {{导入路径:应用程序}}`