【发布时间】:2009-06-03 21:31:32
【问题描述】:
我发现用python写的,一个很简单的http服务器,它的do_get方法是这样的:
def do_GET(self):
try:
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers();
filepath = self.path
print filepath, USTAW['rootwww']
f = file("./www" + filepath)
s = f.readline();
while s != "":
self.wfile.write(s);
s = f.readline();
return
except IOError:
self.send_error(404,'File Not Found: %s ' % filepath)
它工作正常,除了它不提供任何 css 文件(它在没有 css 的情况下呈现)。有人对此怪癖有建议/解决方案吗?
最好的问候, 正宗
【问题讨论】:
-
快速建议:谷歌cherrypy。
-
警告旧线程尝试将 .css 文件存储在 html 文件所在的同一目录中。