我已經找到了用Python編寫的,一個非常簡單的HTTP服務器,它是do_get方法是這樣的:自定義簡單的Python HTTP服務器不服務CSS文件
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呈現)。任何人都有這個問題的建議/解決方案?
最好的問候, praavDa
快速建議:Google cherrypy。 – Triptych 2009-06-03 21:45:28
**警告舊線程**嘗試將.css文件存儲在您的html文件所在的同一目錄中。 – noobninja 2016-04-02 08:03:53