Gunicorn

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(以“Gunicorn: Python WSGI HTTP Server ==简介== ==指南== $ pip install gunicorn $ cat myapp.py def app(environ, start_response): data = b"Hello, World...”为内容创建页面)
 
 
(未显示1个用户的4个中间版本)
第1行: 第1行:
 
Gunicorn: Python WSGI HTTP Server
 
Gunicorn: Python WSGI HTTP Server
 +
 +
[[文件:gunicorn.png|right|gunicorn]]
  
 
==简介==
 
==简介==
 +
 +
==功能==
  
 
==指南==
 
==指南==
 
  $ pip install gunicorn
 
  $ pip install gunicorn
 
  $ cat myapp.py
 
  $ cat myapp.py
    def app(environ, start_response):
+
def app(environ, start_response):
        data = b"Hello, World!\n"
+
    """Simplest possible application object"""
        start_response("200 OK", [
+
    data = 'Hello, World!\n'
            ("Content-Type", "text/plain"),
+
    status = '200 OK'
            ("Content-Length", str(len(data)))
+
    response_headers = [
        ])
+
        ('Content-type','text/plain'),
        return iter([data])
+
        ('Content-Length', str(len(data)))
  $ gunicorn -w 4 myapp:app
+
    ]
  [2014-09-10 10:22:28 +0000] [30869] [INFO] Listening at: http://127.0.0.1:8000 (30869)
+
    start_response(status, response_headers)
  [2014-09-10 10:22:28 +0000] [30869] [INFO] Using worker: sync
+
    return iter([data])
  [2014-09-10 10:22:28 +0000] [30874] [INFO] Booting worker with pid: 30874
+
$ gunicorn -w 4 myapp:app
  [2014-09-10 10:22:28 +0000] [30875] [INFO] Booting worker with pid: 30875
+
[2017-07-16 15:12:27 +0800] [76775] [INFO] Starting gunicorn 19.6.0
  [2014-09-10 10:22:28 +0000] [30876] [INFO] Booting worker with pid: 30876
+
[2017-07-16 15:12:27 +0800] [76775] [INFO] Listening at: http://127.0.0.1:8000 (76775)
  [2014-09-10 10:22:28 +0000] [30877] [INFO] Booting worker with pid: 30877
+
[2017-07-16 15:12:27 +0800] [76775] [INFO] Using worker: sync
 +
[2017-07-16 15:12:27 +0800] [76779] [INFO] Booting worker with pid: 76779
 +
[2017-07-16 15:12:27 +0800] [76780] [INFO] Booting worker with pid: 76780
 +
[2017-07-16 15:12:27 +0800] [76781] [INFO] Booting worker with pid: 76781
 +
[2017-07-16 15:12:27 +0800] [76782] [INFO] Booting worker with pid: 76782
  
 
==项目==
 
==项目==
 +
[[文件:gunicorn-logo.jpg|right|gunicorn]]
 +
*[https://github.com/benoitc/gunicorn Gunicorn @ GitHub]
 +
 +
==文档==
  
 
==图集==
 
==图集==
第27行: 第39行:
 
==链接==
 
==链接==
 
*[http://gunicorn.org/ Gunicorn官网]
 
*[http://gunicorn.org/ Gunicorn官网]
*[https://github.com/benoitc/gunicorn Gunicorn @ GitHub]
+
*[http://docs.huihoo.com/gunicorn/ Gunicorn文档]
  
 
[[category:web server]]
 
[[category:web server]]
 +
[[category:WSGI]]
 
[[category:python]]
 
[[category:python]]

2022年3月14日 (一) 07:42的最后版本

Gunicorn: Python WSGI HTTP Server

gunicorn

目录

[编辑] 简介

[编辑] 功能

[编辑] 指南

$ pip install gunicorn
$ cat myapp.py
def app(environ, start_response):
    """Simplest possible application object"""
    data = 'Hello, World!\n'
    status = '200 OK'
    response_headers = [
        ('Content-type','text/plain'),
        ('Content-Length', str(len(data)))
    ]
    start_response(status, response_headers)
    return iter([data])

$ gunicorn -w 4 myapp:app

[2017-07-16 15:12:27 +0800] [76775] [INFO] Starting gunicorn 19.6.0
[2017-07-16 15:12:27 +0800] [76775] [INFO] Listening at: http://127.0.0.1:8000 (76775)
[2017-07-16 15:12:27 +0800] [76775] [INFO] Using worker: sync
[2017-07-16 15:12:27 +0800] [76779] [INFO] Booting worker with pid: 76779
[2017-07-16 15:12:27 +0800] [76780] [INFO] Booting worker with pid: 76780
[2017-07-16 15:12:27 +0800] [76781] [INFO] Booting worker with pid: 76781
[2017-07-16 15:12:27 +0800] [76782] [INFO] Booting worker with pid: 76782

[编辑] 项目

gunicorn

[编辑] 文档

[编辑] 图集

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱