python中的一个简单的静态文件服务器和目录索引服务器(wsgi应用程序)
FileServer的Python项目详细描述
python中的一个简单的静态文件服务器和目录索引服务器(wsgi a p p)
关于
通常在测试时,您需要一个静态文件服务器和目录 索引作为wsgi堆栈的一部分。另外,你可能有 运行要求,如生产wsgi的一部分 堆叠。文件服务器符合这些需求。
动机
我需要一个目录索引服务器la apache来测试pypi克隆i 正在使用。在调查了外面的情况之后,似乎没有 任何对我来说容易消耗的东西。所以我 只写了一个取决于 webob。
内容
from fileserver import *应该允许您访问 文件服务器的可用组件:
- ^{tt2}$: return a webob response object appropriate to a file name
- ^{tt3}$: WSGI app that wraps ^{tt2}$
- ^{tt5}$: serves a directory tree and generated indices
- ^{tt6}$: command line entry point
FileApp和file_response大量借用 http://docs.webob.org/en/latest/file-example.html。 我还借用了paste的StaticURLParser和static.Cling。
另外还有一个命令行脚本serve,它可以是 用于为目录提供 wsgiref服务器。