Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用命令启动 http 服务器时:
python -m SimpleHTTPServer
如何更改默认的 404 页面?
使用命令行,这是不可能的。
您应该制作如下脚本:
import BaseHTTPServer import SimpleHTTPServer class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): error_message_format = ''' custom error message ''' BaseHTTPServer.test(MyHandler, BaseHTTPServer.HTTPServer)