跳转到主要内容

提供静态文件。

项目描述

提供简单高效的服务静态文件的方式。用作演示。如果您的系统上可用,则可处理sendifle api。

需求

  • Python 2.5或更高版本

  • Gevent > 0.13

  • Pistil >= 0.1.0

  • http-parser >= 0.6.3

注意:要设置进程名称,请安装库setproctitle

$ ps ax|grep test_cors
78064 s002  S+     0:00.35 arbiter [test_cors running 3 workers]
78065 s002  S+     0:00.10 worker test_cors [78065]
78066 s002  S+     0:00.11 worker test_cors [78066]
78067 s002  S+     0:00.09 worker test_cors [78067]

安装

从PyPI安装,执行以下命令之一

pip install fserve

easy_install fserve

从源安装

$ git clone git://github.com/benoitc/fserve.git
$ cd fserve && python setup.py install

用法

$ fserve [-h] [--bind BIND] [--workers WORKERS] [--debug] [path]

serve a static file folder

positional arguments:
  path               Folder to serve

optional arguments:
  -h, --help         show this help message and exit
  --bind BIND        The socket to bind. A string of the form: 'HOST',
                     'HOST:PORT', 'unix:PATH'. An IP is a valid HOST.
  --name NAME        name of the server
  --workers WORKERS  Number of workers
--debug            Debug mode

示例

在您的源文件夹中

$ cd examples/static
$ fserve --workers 3

然后访问http://127.0.0.1:5000 URL。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

fserve-0.2.0.tar.gz (5.7 kB 查看散列)

由以下支持