1 Star 0 Fork 97

huzorro / pkgdoc

forked from 刘地 / pkgdoc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
wsgi.py 633 Bytes
一键复制 编辑 原始数据 按行查看 历史
刘志曦 提交于 2014-10-16 00:17 . x
from os.path import isfile,isdir
import os
def application(environ, start_response):
status = '200 OK'
path=environ['PATH_INFO']
if path=='/':
path='/index.html'
if path[-3:]=='css':
response_headers = [('Content-type','text/css')]
else:
response_headers = [('Content-type','text/html')]
start_response(status, response_headers)
if isfile('static'+path):
with open('static'+path,'r') as file:
return [file.read()]
if isdir('static'+path):
dir=os.listdir('static'+path)
return ['<html><body>','\r\n'.join(['<a href="%s/%s">%s</a><br/>'%(path,d,d) for d in dir]),'</body></html>']
return ['<h1>not find</h1>']
1
https://gitee.com/huzorro/pkgdoc.git
git@gitee.com:huzorro/pkgdoc.git
huzorro
pkgdoc
pkgdoc
master

搜索帮助