小型开发Web服务器

webdev的Python项目详细描述


关于

这是一个用于开发或共享的小型Web服务器。 它允许通过http服务您机器中的任何目录。 它基于python著名的simplehttpserver,它只依赖于 Python2.7解释器和标准库。

SimpleHTTPServer相反,此开发Web服务器:

  • 允许将服务文件夹作为第一个位置参数传递。 默认为当前目录。
  • 如果服务文件夹被删除,将以404响应;而不是崩溃。
  • 如果重新创建文件夹,将返回正常操作。 对于执行干净操作的构建系统非常有用。
  • 如果开发时必须使用安全性,则可以指定绑定IP。

SimpleHTTPServer一样,此Web服务器可以:

  • 指定绑定端口。
  • 列出目录。
  • 自动将index.htmlindex.html作为目录项。

安装

pip install webdev

用法

$ webdev --help
usage: webdev [-h] [-v] [--version] [-i IP] [-p PORT] [-f] [-r RANGE] [-u]
              [path]

Development Web Server

positional arguments:
  path                  Path to serve. Default: Current directory.

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity level
  --version             show program's version number and exit
  -i IP, --ip IP        IP to bind to. Default: 0.0.0.0
  -p PORT, --port PORT  Port to listen to. Default: 8080.
  -f, --force-port      Force the use of the given port.
  -r RANGE, --range RANGE
                        Number of ports to try from the base port
  -u, --future          Ignore if the folder to server doesn't exists yet

变更日志

1.1.0

new

  • 增加了对python 3的支持(第5版)。
  • 增加了对增量自动端口选择的支持(问题2)。
  • 添加了允许Web服务器为不存在的服务 文件夹,假设它将在将来创建(第3期)。

已更改

  • ctrl+c现在被处理(问题4)。

1.0.0

  • 初次发布

许可证

Copyright (C) 2015-2016 Carlos Jenkins <carlos@jenkins.co.cr>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用Java中的扫描仪读取文本文件中的特定字符?   java如果我们在hibernate中开始事务但不提交它,会发生什么?   Azure CosmosDB Java Springboot中的无服务器帐户不支持spring boot设置提供吞吐量或容器自动导航   附加到新对象的Java注释?   java如何将自定义文本视图添加到。在Kotlin中添加通知操作   java Shibboleth添加_OpenSAMLcookies,导致HTTP头大小>8k   分布式传感器数据(~40Hz)的高效Java观测器设计   java如何在while循环外声明数组,但在while循环中初始化它?   用@XmlElementRef注释的java元素没有显示在JAXB编组字符串中?   java替换二维数组的值   java如何在任务栏上创建Windows7加载栏   java如何在组件注释bean中使用会话或RequestScope bean?   java netbeans freermarker插件错误:在实现版本中请求netbeans桥的插件Lexer   java谷歌地图方向。加载失败,返回服务器错误   java当我试图递归地计算两个值之间的整数之和时,为什么结果返回一个奇怪的值?   java如何通过html文件的用户获取运行时输入,以使用Jsoup进行解析?