Gunicorn 0.17.2文档 Installation

安装

按如下步骤安装Gunicorn

要求

  • Python 2.x>=2.6(很快将会支持Python 3.x)
  • setuptools>=0.6c6
  • nosetests(只针对测试)

以easy_install安装

如果你还没有可用的easy_install,你可能需要下载并运行ez_setup.py脚本:

$ curl -o http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python ez_setup.py -U setuptools

安装或者更新最新版本的Gunicorn:

$ sudo easy_install  -U gunicorn

 

从源码安装

你可以像安装其他任何Python包一样从源码安装Gunicorn。Gunicorn使用的setuptools将会自动的拉取全部依赖关系(包括setuptools本身)。

你可以从GitHub Downloads下载一个包含最近源码的tarball文件,或者用git直接拉取:

#Using git:
$ git clone git://github.com/benoitc/gunicorn.git 
$ cd gunicorn

#Or using a tarball:
$ wget http://github.com/benoitc/gunicorn/tarball/master -o gunicorn.tar.gz
$ tar -xzvf gunicorn.tar.gz
$ cd gunicorn -$HASH/

#Install
$ sudo python setup.py install

如果你已经克隆了git仓库,那么强烈建议你使用develop 命令,它可以允许你从源码目录使用Gunicorn。这回允许你与Github上的开发变更保持一致:

$ python setup.py develop

异步工作

You may also want to install Eventlet or Gevent if you expect that your application code may need to pause for extended periods of time during request processing. 当你考虑不同的工作类型中的一种的时候,查阅 design docs 来获得更多信息。

$ easy_install -U greenlet  # Required for both
$ easy_install -U eventlet  # For eventlet workers
$ easy_install -U gevent    # For gevent workers

Debian GUN/Linux

如果你使用Debian GUN/Linux,那么建议你使用系统包来安装Gunicorn,除非你想要通过virtualenv来使用不同版本的gunicorn。这样做有以下优点:

  • 零操作安装:基于定义于 /etc/gunicorn.d中的配置文件自动的启动多个Gunicorn实例。
  • 合理设置log文件的位置(/var/log/gunicorn)。Logs可以使用logrotate自动的转换和压缩。
  • 更好的安全性:可以简单的运行每个Gunicorn实例,通过特定的UNIX 用户/组。
  • 合理的升级路径:升级到新版本需要更少的停机时间,在配置选项中处理产生冲突的变更,且在产生不兼容的情况下能更快的回滚。包也可以在几秒钟的时间里从系统中清除。

稳定版(“squeeze”)

Gunicorn在Debian 中的“稳定”版本是0.10.0(2010年七月)。不建议使用这个版本。

但是,你可以通过Debian Backports使用多数最近的版本。首先,拷贝如下内容到你的/etc/apt/sources.list中:

deb http://backports.debian.org/debian-backports squeeze-backports main

然后,更新你的本地包列表:

$ sudo apt-get update

然后你可以安装最新版本:

$ sudo apt-get -t squeeze-backports install gunicorn

测试版(“wheezy”)/不稳定版(“sid”)

 “wheezy” 和 “sid” 包含了Gunicorn的最新发布版本。可以用通常的方式 安装:

$ sudo apt-get install gunicorn

Ubuntu

如果你使用Ubuntu,你可以添加ppa:guincorn/ppa到你系统的软件源中来通过我们的PPA更新你的系统包。使用python-software-properties包中的apt-get-repository命令来添加Gunicorn软件源。

$ sudo apte-add-repository ppa:gunicorn/ppa

或者这个PPA可以通过拷贝下面两行并添加到你系统的软件源中被手动的加入到你系统中:

deb http://ppa.launchpad.net/gunicorn/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/gunicorn/ppa/ubuntu lucid main

将‘lucid’替换为你的Ubuntu版本序列。

签名密钥

1024R/5370FF2A

指纹

FC7B41B54C9B8476D9EC22A2C6773E575370FF2A

转载于:https://www.cnblogs.com/hansonfox/archive/2013/03/24/gunicorn_installation.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值